Python Reference

Types

creating a list creating a dictionary create a string creation of number create a floating point number creating a tuple

Lists

adding an item to the end of a list delete all list items copy of the list number of times an element occurs in a list adding elements from the specified object to the list index of the first occurrence of an element in a list add an element before the specified index remove element by its index remove item from list list reversal

Dictionaries

delete all dictionary elements copy of dictionary dictionary meaning by key key-value tuple dictionary keys delete element by its key delete key-value pair adding a default value to a key updating a dictionary with keys and values ​​of another dictionary dictionary meanings

Sets

intersection of sets adding elements to a set removing elements from a set removing elements that are in a set removing the first element from a set set clearing union of sets adding elements from other sets difference of sets presence of elements of a set presence of elements in a set exclusion of common elements of a set immutable set

Mathematics

modulus of a number minimum number maximum number power of a number square root of a number sum of numbers fractional sum of numbers factorial of a number rounding off a number rounding a number down rounding a number up a tuple of fractional and integer parts of a number remainder from division of numbers remainder of division of floating point numbers tuple of quotient and remainder after division

Random numbers

pseudo random number generate random integer from range generate random real from range random number from range random element from a sequence random sample from a sequence sequence shuffle random number initialization

Partitions

merge list into string split string into list split string into list from end split string by first substring match split string by last substring match

Formatting

delete characters in a string removes characters from the beginning of a line remove characters from the end of a line string formatting padding the beginning of a string with zeros left align text right align text

Search

check from the beginning of the line check from end of line search by string search by string search by string from end search by string from end search and replace in string count occurrences in a string

Register

lowercase string characters change case to opposite uppercase first character lowercase string characters uppercase the first character of each word uppercase string characters

Checks

check first character of word for uppercase check string characters for uppercase check for letters and numbers in a string check if string contains only letters check if string contains only numbers check string characters for lowercase check if string contains only numbers check if string contains only spaces

Regulars

replacement exchange change substitution substitute commutation shift sub makeshift spell stopgap stand-in tuple of string and number of replacements splitting a string into a list list of all matches by regular expression iterator of all regular expression matches regular expression search for first match search for a regular expression match at the beginning of a line search for all matches in a string with a regular expression information about matches with regular expression

Iterators

length of object sorting list items sorted list of iterable objects filtering iterables iterating over iterable objects simultaneous enumeration

Main

opening file reading file reading the first line of a file reading all lines of a file file recording closing file

Operations

file deletion copy file copy file with metadata create folder creating folders delete folder rename file or folder recursive movement recursive folder deletion recursive copy folder

Overkill

list of files in folder iterate through files in a folder object with files and subfolders

Checks

check for path existence check for folder check for file

Miscellaneous

file size path merging file status disk usage statistics current working folder

Time

leap year intercalary year bissextile leap-year creating a date object current date creating a time object current time creating a date and time object formatted string with date and time time in seconds since the beginning of the epoch convert seconds to datetime string convert seconds to local time convert seconds to UTC convert datetime string to seconds stops the operation for the specified number of seconds
enru