Posts Tagged with 'Python'

Python | map() Function The map() function executes a specified function for each item in an iterable. The map() function in Python has two parameters, function and iterable. The map() function takes a function as an argument and …

Last updated 1 year, 10 months ago | 419 views

Tags:- Python

Python | Send an email To send an email, Python provides smtplib and email modules. Import these modules into the created mail script and send mail by authenticating a user. It has a method SMTP(smtp-server, port). …

Last updated 1 year, 10 months ago | 455 views

Tags:- Python

Python | enumerate() Function The enumerate() function is used to iterate through the sequence and retrieve the index position and its corresponding value at the same time.   lst = ["A","B","C"] print (list(enumerate(lst))) #[(0, 'A'), (1, 'B'), …

Last updated 1 year, 10 months ago | 501 views

Tags:- Python

Python | Generator Functions that return an iterable set of items are called generators. It is a normal function except that it yields expression in the function. It does not implements __itr__ and next() method and …

Last updated 1 year, 10 months ago | 443 views

Tags:- Python

Python | strip() Function | Remove whitespaces from a string  To remove the whitespaces and trailing spaces from the string, Python provides a strip([str]) built-in function. This function returns a copy of the string after removing whitespaces …

Last updated 1 year, 10 months ago | 444 views

Tags:- Python

Python | swapcase() Function It is a string's function that converts all uppercase characters into lowercase and vice versa. It automatically ignores all the non-alphabetic characters.   string = "IT IS IN LOWERCASE." print(string.swapcase())  

Last updated 1 year, 10 months ago | 512 views

Tags:- Python

Python | zip() Function Python zip() function returns a zip object, which maps a similar index of multiple containers. It takes an iterable, converts it into an iterator, and aggregates the elements based on the iterable passed. …

Last updated 1 year, 10 months ago | 535 views

Tags:- Python

Python | Monkey Patching In Python, the term monkey patch only refers to dynamic modifications of a class or module at run-time.   # m.py class A: def func(self): print("Hi") import m def monkey(self): print …

Last updated 1 year, 10 months ago | 553 views

Tags:- Python

Python | Pickling, and Unpickling The pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using the dump function, this process is called pickling. …

Last updated 1 year, 10 months ago | 484 views

Tags:- Python

Python | Lambda function A lambda function is a small anonymous function. This function can have any number of parameters but, can have just one statement.     Syntex:  lambda arguments : expression   a = lambda x,y : …

Last updated 1 year, 10 months ago | 500 views

Tags:- Python

Python | Main Function In the world of programming languages, the main is considered as an entry point of execution for a program. But in python, it is known that the interpreter serially interprets the file …

Last updated 1 year, 10 months ago | 382 views

Tags:- Python

Python | Deep and Shallow copies Shallow copy does the task of creating new objects and storing references to original elements. This does not undergo recursion to create copies of nested objects. It just copies the …

Last updated 1 year, 10 months ago | 378 views

Tags:- Python

Python | Generate random numbers Python provides a module called random using which we can generate random numbers. e.g: print(random.random())     We have to import a random module and call the random() method as shown …

Last updated 1 year, 10 months ago | 418 views

Tags:- Python

Python modules are the files having python code which can be functions, variables, or classes. These go by .py extension. The most commonly available built-in modules are: os math sys random re datetime JSON

Last updated 1 year, 10 months ago | 364 views

Tags:- Python

Python |  issubclass() This is done by using a method called issubclass() provided by python. The method tells us if any class is a child of another class by returning true or false accordingly.     …

Last updated 1 year, 10 months ago | 411 views

Tags:- Python