String Methods Flashcards

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
Q

str.lower()

A

Converts a string to lowercase.

26
Q

str.lstrip()

A

Returns a left stripped version of the string.

27
Q

str.maketrans()

A

Makes a translation table to be used in translations.

28
Q

str.partition()

A

Returns a triple where the string is split into three parts.

29
Q

str.replace()

A

Returns a string where a value is replaced with a different value.

30
Q

str.rfind()

A

Searches for the last instance of a value and returns it’s position.

31
Q

str.rindex()

A

Searches for a value and returns it’s last occurrence.

32
Q

str.rpartition()

A

Returns a triple with the string in three parts.

33
Q

str.rsplit()

A

Splits the string at specified separator and returns a list.

34
Q

str.rstrip()

A

Return a right trimmed string.

35
Q

str.split()

A

Splits a string at separator and returns a list.

36
Q

str.splitlines()

A

Splits string at line breaks and returns a list.

37
Q

str.startswith()

A

Returns true if a string starts with a specified value.

38
Q

str.swapcase()

A

Swaps upper and lower case,

39
Q

str.title()

A

Converts the first letter of each word to a capital.

40
Q

str.translate()

A

Returns a translated string.

41
Q

str.upper()

A

Converts a string to all upper case.

42
Q

str.zfill()

A

Fills a string with a specified number of zeros at the end.