Python Reference

Types

list creation dictionary creation string creation integer creation floating point number creation tuple creation

Lists

adding an element to the end of a list removing all elements from a list copy of a list number of element occurrences in a list adding elements from a specified object to a list index of the first occurrence of an element in a list adding an element before a specified index removing an element by its index removing an element from a list reversing a list

Dictionaries

removing all dictionary items dictionary copy dictionary value by key key-value tuple dictionary keys removing an item by its key removing a key-value pair setting a default value for a key updating a dictionary with keys and values from another dictionary dictionary values

Sets

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

Mathematics

absolute value of a number smallest number largest number power of a number square root of a number sum of numbers fractional sum of numbers factorial of a number rounding a number rounding a number down rounding a number up tuple of fractional and integer parts of a number remainder of division of numbers remainder of division of floating point numbers tuple of quotient and remainder from division

Random Numbers

pseudorandom number generate a random integer from a range generate a random float from a range random number from a range random element from a sequence random sample from a sequence shuffle a sequence random number initialization

Splitting

merging a list into a string splitting a string into a list splitting a string into a list from the end splitting a string by the first occurrence of a substring splitting a string by the last occurrence of a substring

Formatting

removing characters in a string removing characters at the beginning of a string removing characters at the end of a string string formatting filling the beginning of a string with zeros aligning text to the left aligning text to the right

Search

checking from the beginning of the string checking from the end of the string searching through a string searching through a string searching through a string from the end searching through a string from the end search and replace in a string count occurrences in a string

Case

string characters in lowercase changing case to the opposite uppercase for the first character string characters in lowercase uppercase for the first character of each word string characters in uppercase

Checks

checking the first character of a word for uppercase checking string characters for uppercase checking for letters and digits in a string checking for only letters in a string checking for only digits in a string checking string characters for lowercase checking for only numbers in a string checking for only spaces in a string

Regular Expressions

replacement tuple of string and number of replacements splitting a string into a list list of all regex matches iterator of all regex matches search for the first regex match search for regex match at the beginning of a string search for all regex matches in a string information about regex matches

Iterators

object length sorting list elements sorted list from iterable objects filtering iterable objects iterating over iterable objects simultaneous iteration

Basic

opening a file reading a file reading the first line of a file reading all lines of a file writing to a file closing a file

Operations

deleting a file copying a file copying a file with metadata creating a folder creating folders deleting a folder renaming a file or folder recursive moving recursive folder deletion recursive folder copying

Iteration

list of files in a folder iterating over files in a folder object with files and subfolders

Checks

checking if a path exists checking if it's a folder checking if it's a file

Miscellaneous

file size joining paths file status disk usage statistics current working directory

Time

leap year creating a date object current date creating a time object current time creating a datetime object formatted date and time string time in seconds since the epoch converting seconds to a date and time string converting seconds to local time converting seconds to UTC format converting a date and time string to seconds pausing operation execution for a specified number of seconds
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline