String Methods Flashcards

(42 cards)

1
Q

str.capitalize()

A

Return a copy of the string with its first character capitalized and the rest lowercase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

str.casefold()

A

Return a case folded copy of the string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

str.center()

A

Return a centered string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

str.count()

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

str.encode()

A

Returns an encoded version of the string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

str.endswith()

A

Returns true if the string ends with specified value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

str.expandtabs()

A

Sets the tab size of the string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

str.find()

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

str.format()

A

Formats specified values in a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

str.format_map()

A

Formats specified values in a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

str.index()

A

Searches a string for a specified value and returns it’s position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

str.isalnum()

A

Returns true if all characters are alpha numeric.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

str.isalpha()

A

Returns true if all characters are letters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

str.isdecimal()

A

Returns true if all characters are decimals.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

str.isdigit()

A

Returns true if all characters are digits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

str.isidentifier()

A

Returns true if string is an identifier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

str.islower()

A

Returns true if all characters are lower case.

18
Q

str.isnumeric()

A

Returns true if all characters are numeric.

19
Q

str.isprintable()

A

Returns true if all characters are printable.

20
Q

str.isspace()

A

Returns true if all characters are white space.

21
Q

str.istitle()

A

Returns true if the string follows the rules of a title.

22
Q

str.isupper()

A

Returns true if all characters are upper case.

23
Q

str.join()

A

Joins the elements of an iterablevto the end of the string.

24
Q

str.ljust

A

Returns a left justified version of the string.

25
str.lower()
Converts a string to lowercase.
26
str.lstrip()
Returns a left stripped version of the string.
27
str.maketrans()
Makes a translation table to be used in translations.
28
str.partition()
Returns a triple where the string is split into three parts.
29
str.replace()
Returns a string where a value is replaced with a different value.
30
str.rfind()
Searches for the last instance of a value and returns it’s position.
31
str.rindex()
Searches for a value and returns it’s last occurrence.
32
str.rpartition()
Returns a triple with the string in three parts.
33
str.rsplit()
Splits the string at specified separator and returns a list.
34
str.rstrip()
Return a right trimmed string.
35
str.split()
Splits a string at separator and returns a list.
36
str.splitlines()
Splits string at line breaks and returns a list.
37
str.startswith()
Returns true if a string starts with a specified value.
38
str.swapcase()
Swaps upper and lower case,
39
str.title()
Converts the first letter of each word to a capital.
40
str.translate()
Returns a translated string.
41
str.upper()
Converts a string to all upper case.
42
str.zfill()
Fills a string with a specified number of zeros at the end.