跳到主要内容

📖 Python 参考手册

📖 Python 参考手册

Python 内置函数

  1. Python abs() 函数 returns absolute value of a number
  2. Python any() 函数 Checks if any Element of an Iterable is True
  3. Python all() 函数 returns true when all elements in iterable is true
  4. Python ascii() 函数 Returns String Containing Printable Representation
  5. Python bin() 函数 converts integer to binary string
  6. Python bool() 函数 Converts a Value to Boolean
  7. Python bytearray() 函数 returns array of given byte size
  8. Python callable() 函数 Checks if the Object is Callable
  9. Python bytes() 函数 returns immutable bytes object
  10. Python chr() 函数 Returns a Character (a string) from an Integer
  11. Python compile() 函数 Returns a Python code object
  12. Python classmethod() 函数 returns class method for given function
  13. Python complex() 函数 Creates a Complex Number
  14. Python delattr() 函数 Deletes Attribute From the Object
  15. Python dict() 函数 Creates a Dictionary
  16. Python dir() 函数 Tries to Return Attributes of Object
  17. Python divmod() 函数 Returns a Tuple of Quotient and Remainder
  18. Python enumerate() 函数 Returns an Enumerate Object
  19. Python staticmethod() 函数 transforms a method into a static method
  20. Python filter() 函数 constructs iterator from elements which are true
  21. Python eval() 函数 Runs Python Code Within Program
  22. Python float() 函数 returns floating point number from number, string
  23. Python format() 函数 returns formatted representation of a value
  24. Python frozenset() 函数 returns immutable frozenset object
  25. Python getattr() 函数 returns value of named attribute of an object
  26. Python globals() returns dictionary of current global symbol table
  27. Python exec() 函数 Executes Dynamically Created Program
  28. Python hasattr() 函数 returns whether object has named attribute
  29. Python help() 函数 Invokes the built-in Help System
  30. Python hex() 函数 Converts to Integer to Hexadecimal
  31. Python hash() 函数 returns hash value of an object
  32. Python input() 函数 reads and returns a line of string
  33. Python id() 函数 Returns Identify of an Object
  34. Python isinstance() 函数 Checks if a Object is an Instance of Class
  35. Python int() 函数 returns integer from a number or string
  36. Python issubclass() 函数 Checks if a Class is Subclass of another Class
  37. Python iter() 函数 returns an iterator
  38. Python list() 函数 creates a list in Python
  39. Python locals() 函数 Returns dictionary of a current local symbol table
  40. Python len() 函数 Returns Length of an Object
  41. Python max() 函数 returns the largest item
  42. Python min() 函数 returns the smallest value
  43. Python map() 函数 Applies Function and Returns a List
  44. Python next() 函数 Retrieves next item from the iterator
  45. Python memoryview() 函数 returns memory view of an argument
  46. Python object() 函数 creates a featureless object
  47. Python oct() 函数 returns the octal representation of an integer
  48. Python ord() 函数 returns an integer of the Unicode character
  49. Python open() 函数 Returns a file object
  50. Python pow() 函数 returns the power of a number
  51. Python print() 函数 Prints the Given Object
  52. Python property() 函数 returns the property attribute
  53. Python range() 函数 returns a sequence of integers
  54. Python repr() 函数 returns a printable representation of the object
  55. Python reversed() 函数 returns the reversed iterator of a sequence
  56. Python round() 函数 rounds a number to specified decimals
  57. Python set() 函数 constructs and returns a set
  58. Python setattr() 函数 sets the value of an attribute of an object
  59. Python slice() 函数 returns a slice object
  60. Python sorted() 函数 returns a sorted list from the given iterable
  61. Python str() 函数 returns the string version of the object
  62. Python sum() 函数 Adds items of an Iterable
  63. Python tuple() 函数 Returns a tuple
  64. Python type() 函数 Returns the type of the object
  65. Python vars() 函数 Returns the dict attribute
  66. Python zip() 函数 Returns an iterator of tuples
  67. Python import() 函数 Function called by the import statement
  68. Python super() 函数 Returns a proxy object of the base class

Python 字典方法

  1. Python 字典 clear() 方法 Removes all Items
  2. Python 字典 copy() 方法 Returns the Shallow Copy of a Dictionary
  3. Python 字典 fromkeys() 方法 creates dictionary from given sequence
  4. Python 字典 get() 方法 Returns Value of The Key
  5. Python 字典 items() 方法 returns view of dictionary's (key, value) pair
  6. Python 字典 keys() 方法 Returns View Object of All Keys
  7. Python 字典 popitem() 方法 Returns & Removes Latest Element From Dictionary
  8. Python 字典 setdefault() 方法 Inserts Key With a Value if Key is not Present
  9. Python 字典 pop() 方法 removes and returns element having given key
  10. Python 字典 values() 方法 returns view of all values in dictionary
  11. Python 字典 update() 方法 Updates the Dictionary

Python 列表方法

  1. Python 列表 append() 方法 Add a single element to the end of the list
  2. Python 列表 extend() 方法 adds iterable elements to the end of the list
  3. Python 列表 insert() 方法 insert an element to the list
  4. Python 列表 remove() 方法 Removes item from the list
  5. Python 列表 index() 方法 returns the index of the element in the list
  6. Python 列表 count() 方法 returns count of the element in the list
  7. Python 列表 pop() 方法 Removes element at the given index
  8. Python 列表 reverse() 方法 reverses the list
  9. Python 列表 sort() 方法 sorts elements of a list
  10. Python 列表 copy() 方法 returns a shallow copy of the list
  11. Python 列表 clear() 方法 Removes all Items from the List

Python 集合方法

  1. Python 集合 remove() 方法 removes the specified element from the set
  2. Python 集合 add() 方法 adds element to a set
  3. Python 集合 copy() 方法 Returns Shallow Copy of a Set
  4. Python 集合 clear() 方法 remove all elements from a set
  5. Python 集合 difference() 方法 Returns Difference of Two Sets
  6. Python 集合 difference_update() 方法 Updates Calling Set With Intersection of Sets
  7. Python 集合 discard() 方法 Removes an Element from The Set
  8. Python 集合 intersection() 方法 Returns Intersection of Two or More Sets
  9. Python 集合 intersection_update() 方法 Updates Calling Set With Intersection of Sets
  10. Python 集合 isdisjoint() 方法 Checks Disjoint Sets
  11. Python 集合 issubset() 方法 Checks if a Set is Subset of Another Set
  12. Python 集合 issuperset() 方法 Checks if a Set is Superset of Another Set
  13. Python 集合 pop() 方法 Removes an Arbitrary Element
  14. Python Set symmetric_difference() 方法 Returns the symmetric difference of sets
  15. Python Set symmetric_difference_update() 方法 Updates the Set with symmetric difference
  16. Python Set union() 方法 Returns the union of sets
  17. Python Set update() 方法 Add elements to the set
  18. Python frozenset() 函数 returns immutable frozenset object

Python 字符串方法

  1. Python String capitalize() 方法 Converts first character to Capital Letter
  2. Python String center() 方法 Pads string with specified character
  3. Python String casefold() 方法 converts to case folded strings
  4. Python String count() 方法 returns occurrences of substring in string
  5. Python String endswith() 方法 Checks if String Ends with the Specified Suffix
  6. Python String expandtabs() 方法 Replaces Tab character With Spaces
  7. Python String encode() 方法 returns encoded string of given string
  8. Python String find() 方法 Returns the index of first occurrence of substring
  9. Python String format() 方法 formats string into nicer output
  10. Python String index() 方法 Returns Index of Substring
  11. Python String isalnum() 方法 Checks Alphanumeric Character
  12. Python String isalpha() 方法 Checks if All Characters are Alphabets
  13. Python String isdecimal() 方法 Checks Decimal Characters
  14. Python String isdigit() 方法 Checks Digit Characters
  15. Python String isidentifier() 方法 Checks for Valid Identifier
  16. Python String islower() 方法 Checks if all Alphabets in a String are Lowercase
  17. Python String isnumeric() 方法 Checks Numeric Characters
  18. Python String isprintable() 方法 Checks Printable Character
  19. Python String isspace() 方法 Checks Whitespace Characters
  20. Python String istitle() 方法 Checks for Titlecased String
  21. Python String isupper() 方法 returns if all characters are uppercase characters
  22. Python 字符串 join() 方法 Returns a Concatenated String
  23. Python 字符串 ljust() 方法 returns left-justified string of given width
  24. Python 字符串 rjust() 方法 returns right-justified string of given width
  25. Python 字符串 lower() 方法 returns lowercased string
  26. Python 字符串 upper() 方法 returns uppercased string
  27. Python 字符串 swapcase() 方法 swap uppercase characters to lowercase; vice versa
  28. Python 字符串 lstrip() 方法 Removes Leading Characters
  29. Python 字符串 rstrip() 方法 Removes Trailing Characters
  30. Python 字符串 strip() 方法 Removes Both Leading and Trailing Characters
  31. Python 字符串 partition() 方法 Returns a Tuple
  32. Python 字符串 maketrans() 方法 returns a translation table
  33. Python 字符串 rpartition() 方法 Returns a Tuple
  34. Python 字符串 translate() 方法 returns mapped charactered string
  35. Python 字符串 replace() 方法 Replaces Substring Inside
  36. Python 字符串 rfind() 方法 Returns the Highest Index of Substring
  37. Python 字符串 rindex() 方法 Returns Highest Index of Substring
  38. Python 字符串 split() 方法 Splits String from Left
  39. Python 字符串 rsplit() 方法 Splits String From Right
  40. Python 字符串 splitlines() 方法 Splits String at Line Boundaries
  41. Python 字符串 startswith() 方法 Checks if String Starts with the Specified String
  42. Python 字符串 title() 方法 Returns a Title Cased String
  43. Python 字符串 zfill() 方法 Returns a Copy of The String Padded With Zeros
  44. Python 字符串 format_map() 方法 Formats the String Using Dictionary

Python 元组方法

  1. Python 元组 count() 方法 returns count of the element in the tuple
  2. Python 元组 index() 方法 returns the index of the element in the tuple