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 | 453 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 | 497 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 | 439 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 | 442 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 | 510 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 | 532 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 | 551 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 | 482 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 | 497 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 | 380 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 | 377 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 | 416 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 | 362 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 | 410 views

Tags:- Python

Finalize method is used for freeing up the unmanaged resources and cleaning up before the garbage collection method is invoked. This helps in performing memory management tasks.

Last updated 1 year, 10 months ago | 377 views

Tags:- Python