Python - Methods

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/101

encourage image

There's no tags or description

Looks like no tags are added yet.

102 Terms

1
New cards

.capitalize()

Converts the first character to upper case

2
New cards

.casefold()

Converts string into lower case

3
New cards

.center()

Returns a centered string

4
New cards

.count()

Returns the number of times a specified value occurs in a string

5
New cards

.encode()

Returns an encoded version of the string

6
New cards

.endswith()

Returns true if the string ends with the specified value

7
New cards

.expandtabs()

Sets the tab size of the string

8
New cards

.find()

Searches the string for a specified value and returns the position of where it was found

9
New cards

.format()

Formats specified values in a string

10
New cards

.format_map()

Formats specified values in a string

11
New cards

.index()

Searches the string for a specified value and returns the position of where it was found

12
New cards

.isalnum()

Returns True if all characters in the string are alphanumeric

13
New cards

.isalpha()

Returns True if all characters in the string are in the alphabet

14
New cards

.isascii()

Returns True if all characters in the string are ascii characters

15
New cards

.isdecimal()

Returns True if all characters in the string are decimals

16
New cards

.isdigit()

Returns True if all characters in the string are digits

17
New cards

.isidentifier()

Returns True if the string is an identifier

18
New cards

.islower()

Returns True if all characters in the string are lower case

19
New cards

.isnumeric()

Returns True if all characters in the string are numeric

20
New cards

.isprintable()

Returns True if all characters in the string are printable

21
New cards

.isspace()

Returns True if all characters in the string are whitespaces

22
New cards

.istitle()

Returns True if the string follows the rules of a title

23
New cards

.isupper()

Returns True if all characters in the string are upper case

24
New cards

.join()

Converts the elements of an iterable into a string

25
New cards

.ljust()

Returns a left justified version of the string

26
New cards

.lower()

Converts a string into lower case

27
New cards

.lstrip()

Returns a left trim version of the string

28
New cards

.maketrans()

Returns a translation table to be used in translations

29
New cards

.partition()

Returns a tuple where the string is parted into three parts

30
New cards

.replace()

Returns a string where a specified value is replaced with a specified value

31
New cards

.rfind()

Searches the string for a specified value and returns the last position of where it was found

32
New cards

.rindex()

Searches the string for a specified value and returns the last position of where it was found

33
New cards

.rjust()

Returns a right justified version of the string

34
New cards

.rpartition()

Returns a tuple where the string is parted into three parts

35
New cards

.rsplit()

Splits the string at the specified separator, and returns a list

36
New cards

.rstrip()

Returns a right trim version of the string

37
New cards

.split()

Splits the string at the specified separator, and returns a list

38
New cards

.splitlines()

Splits the string at line breaks and returns a list

39
New cards

.startswith()

Returns true if the string starts with the specified value

40
New cards

.strip()

Returns a trimmed version of the string

41
New cards

.swapcase()

Swaps cases, lower case becomes upper case and vice versa

42
New cards

.title()

Converts the first character of each word to upper case

43
New cards

.translate()

Returns a translated string

44
New cards

.upper()

Converts a string into upper case

45
New cards

.zfill()

Fills the string with a specified number of 0 values at the beginning

46
New cards

.append()

Adds an element at the end of the list

47
New cards

.clear()

Removes all the elements from the list

48
New cards

.copy()

Returns a copy of the list

49
New cards

.count()

Returns the number of elements with the specified value

50
New cards

.extend()

Add the elements of a list (or any iterable), to the end of the current list

51
New cards

.index()

Returns the index of the first element with the specified value

52
New cards

.insert()

Adds an element at the specified position

53
New cards

.pop()

Removes the element at the specified position

54
New cards

.remove()

Removes the first item with the specified value

55
New cards

.reverse()

Reverses the order of the list

56
New cards

.sort()

Sorts the list

57
New cards

.clear()

Removes all the elements from the dictionary

58
New cards

.copy()

Returns a copy of the dictionary

59
New cards

.fromkeys()

Returns a dictionary with the specified keys and value

60
New cards

.get()

Returns the value of the specified key

61
New cards

.items()

Returns a list containing a tuple for each key value pair

62
New cards

.keys()

Returns a list containing the dictionary's keys

63
New cards

.pop()

Removes the element with the specified key

64
New cards

.popitem()

Removes the last inserted key-value pair

65
New cards

.setdefault()

Returns the value of the specified key. If the key does not exist: insert the key, with the specified value

66
New cards

.update()

Updates the dictionary with the specified key-value pairs

67
New cards

.values()

Returns a list of all the values in the dictionary

68
New cards

.count()

Returns the number of times a specified value occurs in a tuple

69
New cards

.index()

Searches the tuple for a specified value and returns the position of where it was found

70
New cards

.add()

Adds an element to the set

71
New cards

.clear()

Removes all the elements from the set

72
New cards

.copy()

Returns a copy of the set

73
New cards

.difference()

Returns a set containing the difference between two or more sets

74
New cards

.difference_update()

Removes the items in this set that are also included in another, specified set

75
New cards

.discard()

Remove the specified item

76
New cards

.intersection()

Returns a set, that is the intersection of two or more sets

77
New cards

.intersection_update()

Removes the items in this set that are not present in other, specified set(s)

78
New cards

.isdisjoint()

Returns whether two sets have a intersection or not

79
New cards

.issubset()

Returns whether another set contains this set or not

80
New cards

.issuperset()

Returns whether this set contains another set or not

81
New cards

.pop()

Removes an element from the set

82
New cards

.remove()

Removes the specified element

83
New cards

.symmetric_difference()

Returns a set with the symmetric differences of two sets

84
New cards

.symmetric_difference_update()

inserts the symmetric differences from this set and another

85
New cards

.union()

Return a set containing the union of sets

86
New cards

.update()

Update the set with another set, or any other iterable

87
New cards

.close()

Closes the file

88
New cards

.detach()

Returns the separated raw stream from the buffer

89
New cards

.fileno()

Returns a number that represents the stream, from the operating system's perspective

90
New cards

.flush()

Flushes the internal buffer

91
New cards

.isatty()

Returns whether the file stream is interactive or not

92
New cards

.read()

Returns the file content

93
New cards

.readable()

Returns whether the file stream can be read or not

94
New cards

.readline()

Returns one line from the file

95
New cards

.readlines()

Returns a list of lines from the file

96
New cards

.seek()

Change the file position

97
New cards

.seekable()

Returns whether the file allows us to change the file position

98
New cards

.tell()

Returns the current file position

99
New cards

.truncate()

Resizes the file to a specified size

100
New cards

.writable()

Returns whether the file can be written to or not