String Methods

 0    48 fiche    sir
baixar mp3 Imprimir jogar verifique-se
 
questão resposta
Capitalizes first letter of string
começar a aprender
capitalize()
Returns a string padded with fillchar with the original string CENTERED to a total of width columns.
começar a aprender
center(width, fillchar)
Counts how many times str occurs in string or in a substring of string if starting index beg and ending index end are given.
começar a aprender
count(str, beg = 0, end = len(string))
Decodes the string using the codec registered for encoding. encoding defaults to the default string encoding.
começar a aprender
decode(encoding = 'UTF-8', errors = 'strict')
Returns encoded string version of string
on error, default is to raise a ValueError unless errors is given with 'ignore' or 'replace'.
começar a aprender
encode(encoding = 'UTF-8', errors = 'strict')
Expands tabs in string to multiple spaces
defaults to 8 spaces per tab if tabsize not provided.
começar a aprender
expandtabs(tabsize = 8)
Determine if str occurs in string or in a substring of string if starting index beg and ending index end are given returns index if found and -1 otherwise.
começar a aprender
find(str, beg = 0 end = len(string))
Same as find(), but raises an exception if str not found.
começar a aprender
index(str, beg = 0, end = len(string))
Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.
começar a aprender
isalnum()
Returns true if string has at least 1 character and all characters are alphabetic and false otherwise.
começar a aprender
isalpha()
Returns true if string contains only digits and false otherwise.
começar a aprender
isdigit()
Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.
começar a aprender
islower()
Returns true if a unicode string contains only numeric characters and false otherwise.
começar a aprender
isnumeric()
Returns true if string contains only whitespace characters and false otherwise.
começar a aprender
isspace()
Returns true if string is properly "titlecased" and false otherwise.
começar a aprender
istitle()
Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.
começar a aprender
isupper()
Merges (concatenates) the string representations of elements in sequence seq into a string, with separator string.
começar a aprender
join(seq)
Returns the length of the string
começar a aprender
len(string)
Returns a space-padded string with the original string left-justified to a total of width columns.
começar a aprender
ljust(width[, fillchar])
Converts all uppercase letters in string to lowercase.
começar a aprender
lower()
Removes all leading whitespace in string.
começar a aprender
lstrip()
Returns a translation table to be used in translate function.
começar a aprender
maketrans()
Returns the max alphabetical character from the string str.
começar a aprender
max(str)
Returns the min alphabetical character from the string str.
começar a aprender
min(str)
Replaces all occurrences of old in string with new or at most max occurrences if max given.
começar a aprender
replace(old, new [, max])
Same as find(), but search backwards in string.
começar a aprender
rfind(str, beg = 0, end = len(string))
Same as index(), but search backwards in string.
começar a aprender
rindex(str, beg = 0, end = len(string))
Returns a space-padded string with the original string right-justified to a total of width columns.
começar a aprender
rjust(width,[, fillchar])
Removes all trailing whitespace of string.
começar a aprender
rstrip()
Splits string according to delimiter str (space if not provided) and returns list of substrings
começar a aprender
split(str="", num=string. count(str))
split into at most num substrings if given.
Splits string at all (or num) NEWLINEs and returns a list of each line with NEWLINEs removed.
começar a aprender
splitlines(num=string. count('\n'))
Determines if string or a substring of string (if starting index beg and ending index end are given) starts with substring str
returns true if so and false otherwise.
começar a aprender
startswith(str, beg=0, end=len(string))
Performs both lstrip() and rstrip() on string
começar a aprender
strip([chars])
Inverts case for all letters in string.
começar a aprender
swapcase()
Returns "titlecased" version of string, that is, all words begin with uppercase and the rest are lowercase.
começar a aprender
title()
Translates string according to translation table str(256 chars), removing those in the del string.
começar a aprender
translate(table, deletechars="")
Converts lowercase letters in string to uppercase.
começar a aprender
upper()
Returns original string leftpadded with zeros to a total of width characters
intended for numbers, it retains any sign given (less one zero).
começar a aprender
zfill (width)
Returns true if a unicode string contains only decimal characters and false otherwise.
começar a aprender
isdecimal()
Converts string into lower case
começar a aprender
casefold()
Returns True if the string is an identifier
começar a aprender
isidentifier()
Returns a tuple where the string is parted into three parts
começar a aprender
partition()
Splits the string at the specified separator, and returns a list
começar a aprender
rsplit()
Splits the string at the specified separator, and returns a list
começar a aprender
rsplit()
Returns a tuple where the string is parted into three parts
começar a aprender
partition()
Returns a tuple where the string is parted into three parts
começar a aprender
rpartition()
Removes prefix.
começar a aprender
. removeprefix()
Removes suffix.
começar a aprender
. removesuffix()

Você deve entrar para postar um comentário.