Posts Tagged with '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 3 years, 4 months ago | 1470 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 3 years, 4 months ago | 1507 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 3 years, 4 months ago | 1530 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 3 years, 4 months ago | 1495 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 3 years, 4 months ago | 1478 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 3 years, 4 months ago | 1579 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 3 years, 4 months ago | 1422 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 3 years, 4 months ago | 1382 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 3 years, 4 months ago | 1397 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 3 years, 4 months ago | 1339 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 3 years, 4 months ago | 1501 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 3 years, 4 months ago | 1355 views

Tags:- Python

Python | New and Override Modifiers The new modifier is used to instruct the compiler to use the new implementation and not the base class function. The Override modifier is useful for overriding a base class …

Last updated 3 years, 4 months ago | 2187 views

Tags:- Python

Negative indexes mean that you count from the right instead of the left. So, list[-1] refers to the last element, list[-2] is the second-last, and so on.

Last updated 3 years, 4 months ago | 1376 views

Tags:- Python

Python | Access Specifiers Python does not make use of access specifiers specifically like private, public, protected, etc. However, it does not derive this from any variables. It has the concept of imitating the behavior of …

Last updated 3 years, 4 months ago | 1429 views

Tags:- Python