Recently, I'm not sure if it's a built-in function or a method, so I tried to classify the ones I use often.
Click here for all built-in functions
Built-in functions | function |
---|---|
print() | ()Show inside |
str() | Returns an object of type str |
int() | Returns an object of type int |
float() | Returns an object of type float |
bool() | Returns a bool type object. Empty, 0, None returns False |
type() | Returns the type of the object |
input() | Enter a string(Input value is treated as a character string) |
len() | Get the number of elements |
abs() | Returns the absolute value |
sum() | Returns the total |
max() | Returns the maximum value |
min() | Returns the minimum value |
pow(a, b) | Returns a to the bth power |
range() | Returns a sequence of integers in the specified range |
round() | Round the value. The second argument is the number after the decimal point |
hex() | Returns a hexadecimal number |
oct() | Returns an octal number |
bin() | Returns a binary number |
enumerate() | Get the sequence and index. The second argument is the index start number, the default is 0 |
open() | Open file |
Method | function | list | Tuple | Remarks | String |
---|---|---|---|---|---|
.append() | Add an element to the end of the list | 〇 | |||
.extend() | Add a sequence to the end of the list. You can add lists, tuples and dictionaries | 〇 | |||
.reverse() | Reverse the order of list elements | 〇 | |||
.sort() | Sort list elements | 〇 | |||
.remove() | Searches for the same element as the specified value and deletes the first element. The element itself is rewritten | 〇 | |||
.count() | Count how many elements are in the list | 〇 | 〇 | ||
.pop() | Extract only one element of the specified index | 〇 | 〇 | ||
.clear() | Delete all elements | 〇 | 〇 | ||
.keys() | Loop processing for dictionary type key | 〇 | |||
.values() | Loop processing for dictionary type value | 〇 | |||
.items() | Loop processing for dictionary type key and value | 〇 | |||
.keys() | Loop processing for dictionary type key | 〇 | |||
.values() | Loop processing for dictionary type value | 〇 | |||
.items() | Loop processing for dictionary type key and value | 〇 | |||
.upper() | Convert the whole to uppercase | 〇 | |||
.lower() | Convert the whole to lowercase | 〇 | |||
.capitalize() | Make the first letter uppercase and the others lowercase | 〇 | |||
.replace(a, b) | Replace string a with string b | 〇 | |||
.split() | Split a string by specific characters | 〇 | |||
.join(sequence) | Get a concatenated string | 〇 | |||
.index() | Returns the index value at the position where the first specified character appears | 〇 | |||
.format() | {}To()Replace within | 〇 |
Recommended Posts