Python basic functions:
- The print() function: Prints a string
- The raw_input() function: captures characters from the user’s keyboard
- Len () function: calculates the length of a character
- Format (12.3654, ‘6.2F ‘/’0.3%’) function: implements formatted output
- The type() function: queries the type of the object
- Int () function, float() function, STR () function, etc. : type conversion functions
- The id() function: gets the memory address of the object
- The help() function: Python’s help function
- S.i slower function: Judge characters at lower case
- The s.space () function checks whether it is a space
- Str.replace () function: replace character
- The import() function: imports libraries
- Math.sin () : the sin() function
- Math.pow () function: Computes the power function
- 3 times *4: 3 to the fourth power
- Pow (3,4) : 3 to the fourth power
- The os.getcwd() function: gets the current working directory
- The listdir() function displays the files in the current directory
- Socket.gethostbyname () : gets the IP address of a host
- Urllib.urlopen (URL).read(): Opens web content and stores it
- The open().write() function: writes to a file
- The webbrowser.open_new_tab() function creates a new TAB and opens the specified web page using the browser
- Def function_name(parameters): a custom function
- The time.sleep() function: stop for a while
- Random.randint () function: generates a random number
- Range () function: Returns a list, printed from 1 to 100
- File.read () function: Reading a file returns a string
- The file.readlines() function: reads a file and returns a list
- The file.readline() function reads a line of file and returns a string
- Ords () and CHR (ASCII) functions: convert a string to ASCII or ASCIIIS\ to a string
- Find (s[,start,end]) function: finds s from a string
- Strip (), lstrip(), rstrip() functions: remove Spaces
- The split() function: What is used to split the string
- The isalnum() function checks whether it isa valid number or character
- The isalpha() function checks whether the range is full of characters
- Isdigit () : checks if all digits are present
- The lower() function: changes the data to lowercase
- Upper () function: uppercase data
- The startswith(s) function checks if the string startswith s
- The endWith (s) function checks whether the string ends with s
- File.write () function: write function
- File.writeline () function: writes to a file
- The s.append() function inserts data at the end of the data
- The s.insert(3,-1) function inserts data -1 before position 3
- The list() function converts a string to a list
- Index (value) : Finds the location of the first value in the data
- The list.extend() function extracts each piece of data and adds it to the list
- The count() function: The number of occurrences of an element in the statistics
- List.remove (” s “) : removes the first occurrence of s from the data
- Del list[2] deletes the second element of the data
- The pop() function: removes the data at the specified location, with a return value
- Remove (” ha “) function: removes the “HA” element from the original data
- The reverse() function: reverse of the list
- Isinstance () function: determines whether a data is of a certain type
- The abs() function yields the absolute value of a number
- Del x[2] deletes the element in list X with index 2
- File.sort () function: sorts book data
- The tuple() function creates a tuple
- The find() function: the search returns the index
- The join() function: the reverse operation of split
- {} : create a dictionary
- The dict() function: creates a dictionary
- The clear() function clears all entries in the dictionary
- The copy() function copies a dictionary, modifying all dictionaries
- D.c. opy() function: Copies a dictionary, only modifying the current dictionary
- The get() function queries elements in the dictionary
- The items() function returns all dictionaries to a list
- Iteritems () function: same as the items function
- The popitem() function removes elements from the dictionary
- The update() function: updates one dictionary entry with another
- Pass: Do nothing
- Exec: Executes a piece of code
- Eval: Evaluates Python expressions
- Ord () function: returns the int value of a single-character string
- The zip(sep1, sep2) function: creates a new sequence of parallel iterations in English
- Def hello() : custom function
- The import() function loads the extension library
Several common built-in functions used in Python
- Abs (x) is used to return the absolute value
- Divmod (x,y) returns a tuple (quotient, remainder) of the result of x/y.
- Pow (x,y) is used to find x to the y
- The all(iterable) function passes in an iterable object and returns True if all the numbers in the object have True bool values, or Flase otherwise
- The any(iterable) function passes in an iterable object that returns True if any of the numbers is True and Flase if all of the numbers are zero
- The CHR (x) function passes in an ASCII code and converts ASCII to the corresponding character
- The ord(x) function passes in a character that is converted to the corresponding ASCII code
- Hex () hexadecimal
- Oct (8) into the system
- Bin (2) into the system
- The x passed in enumerate(x,y) is a list, and y is the initial value for iteration
- The reduce() function is also a higher-order function built into Python. Reduce () takes arguments similar to Map (), a function F and a list, but behaves differently from Map (). Reduce () passes in f and must take two arguments. Reduce () calls f repeatedly for each element of list and returns the final result.
- Customizable sorted functions. Python’s built-in sorted() function sorts lists
Click 🎁🎁 to pick up dry goods full