#Enter python interpreter.
python
#Exit python interpreter.
exit()
#Help page on modules or inbuilt functions.
help()
Tip: Enter module or function name in the parentheses
#List installed python modules.
help('modules')
#Create virtual environment in current folder.
python -m venv ./venv
#Activate virtual environment in current directory.
source .venv/bin/activate
#Exit virtual environment.
deactivate
#Run python script from IDLE.
exec(open('path/to/file or filename').read())
#Redirect the modules and dependencies installed to requirements.txt.
pip3 freeze > requirements.txt
#Install modules whose names are listed in a file (requirements.txt)
pip3 install -r requirements.txt
#Find out pip version
pip3 --version
#Sort a 2D list (lst) based on any one index (i is the index)
lst.sort(key = lambda x : x[i])
#Return the absolute value of a number.
abs()
#Print command can be used to print any type of object like integer,string, list, tuple, etc.
print(object)
#Round is used to round a number to a given precision in decimal digits.
round(number, digits)
#Return an asynchronous iterator for an asynchronous iterable.
aiter()
#Return True if all elements of the iterable are true.
all()
#Return True if any element of the iterable is true.
any()
#Return a string with a printable representation of an object.
ascii()
#Convert an integer number to a binary string.
bin()
#Return a Boolean value.
bool()
#Ends a loop prematurely.
break
#Drops you into the debugger at the call site.
breakpoint()
#Return a new array of bytes.
bytearray()
#Return a new “bytes” object.
bytes()
#Return True if the object argument is callable, False if not.
callable()
#Return the string representing a character.
chr()
#Transform a method into a class method.
classmethod()
#Compile the source into a code or AST object.
compile()
#Return a complex number with the value real + imag*1j.
complex()
#Continues the execution of the current loop.
continue
#Deletes the named attribute, provided the object allows it.
delattr()
#Create a new dictionary.
dict()
#Return the list of names in the current local scope.
dir()
#Return a pair of numbers consisting of their quotient and remainder.
divmod()
#Return an enumerate object.
enumerate()
#Evaluates and executes an expression.
eval()
#This function supports dynamic execution of Python code.
exec()
#Construct an iterator from an iterable and returns true.
filter()
#Return a floating point number from a number or string.
float()
#Convert a value to a “formatted” representation.
format()
#Return a new frozenset object.
frozenset()
#Return the value of the named attribute of object.
getattr()
#Return the dictionary implementing the current module namespace.
globals()
#True if the string is the name of one of the object’s attributes.
hasattr()
#Return the hash value of the object.
hash()
#Invoke the built-in help system.
help()
#Convert an integer number to a lowercase hexadecimal string.
hex()
#Return the “identity” of an object.
id()
#This function takes an input and converts it into a string.
input()
#Return an integer object constructed from a number or string.
int()
#Return True if the object argument is an instance of an object.
isinstance()
#Return True if class is a subclass of classinfo.
issubclass()
#Return an iterator object.
iter()
#Return the length (the number of items) of an object.
len()
#Rather than being a function, list is a mutable sequence type.
list()
#Update and return a dictionary with the current local symbol table.
locals()
#Return an iterator that applies function to every item of iterable.
map()
#Return the largest item in an iterable.
max()
#Return the smallest item in an iterable.
min()
#Retrieve the next item from the iterator.
next()
#Return a new featureless object.
object()
#Convert an integer number to an octal string.
oct()
#Open file and return a corresponding file object.
open()
#Return an integer representing the Unicode code point of a character.
ord()
#Return base to the power exp.
pow()
#Print objects to the text stream file.
print()
#Return a property attribute.
property()
#Return a string containing a printable representation of an object.
repr()
#Return a reverse iterator.
reversed()
#Return number rounded to ndigits precision after the decimal point.
round()
#Return a new set object.
set()
#This is the counterpart of getattr().
setattr()
#Return a sliced object representing a set of indices.
slice()
#Sorts a list in the same list sequence.
sort()
#Return a new sorted list sequence from the items in iterable.
sorted()
#Transform a method into a static method.
staticmethod()
#Return a str version of object.
str()
#Sums start and the items of an iterable.
sum()
#Return a proxy object that delegates method calls to a parent or sibling.
super()
#Rather than being a function, is actually an immutable sequence type.
tuple()
#Return the type of an object.
type()
#Return the dict attribute for any other object with a dict attribute.
vars()
#Iterate over several iterables in parallel.
zip()
#This function is invoked by the import statement.
import()
#Returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default).
range()
#This string method splits a string into a list.
string.split(separator, maxsplit)
#This method adds an element at the end of the list.
list.append(element)
#This method removes the first item from list whose value is equal to the element.
list.remove(element)
#This method inserts an item at a given index/position
list.insert(index, x)
#Removes an item at the given postion in the list and returns it
list.pop([i])
#Clears the entire list
list.clear()
#Count the number of times x appears in the list
list.count(x)
#Reverses the elements of the list
list.reverse()
#Returns a shallow copy of a list
list.copy()