String Methods

 0    48 informačný list    sir
stiahnuť mp3 vytlačiť hrať Skontrolujte sa
 
otázka Odpoveď
Capitalizes first letter of string
začať sa učiť
capitalize()
Returns a string padded with fillchar with the original string CENTERED to a total of width columns.
začať sa učiť
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.
začať sa učiť
count(str, beg = 0, end = len(string))
Decodes the string using the codec registered for encoding. encoding defaults to the default string encoding.
začať sa učiť
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'.
začať sa učiť
encode(encoding = 'UTF-8', errors = 'strict')
Expands tabs in string to multiple spaces
defaults to 8 spaces per tab if tabsize not provided.
začať sa učiť
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.
začať sa učiť
find(str, beg = 0 end = len(string))
Same as find(), but raises an exception if str not found.
začať sa učiť
index(str, beg = 0, end = len(string))
Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.
začať sa učiť
isalnum()
Returns true if string has at least 1 character and all characters are alphabetic and false otherwise.
začať sa učiť
isalpha()
Returns true if string contains only digits and false otherwise.
začať sa učiť
isdigit()
Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.
začať sa učiť
islower()
Returns true if a unicode string contains only numeric characters and false otherwise.
začať sa učiť
isnumeric()
Returns true if string contains only whitespace characters and false otherwise.
začať sa učiť
isspace()
Returns true if string is properly "titlecased" and false otherwise.
začať sa učiť
istitle()
Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.
začať sa učiť
isupper()
Merges (concatenates) the string representations of elements in sequence seq into a string, with separator string.
začať sa učiť
join(seq)
Returns the length of the string
začať sa učiť
len(string)
Returns a space-padded string with the original string left-justified to a total of width columns.
začať sa učiť
ljust(width[, fillchar])
Converts all uppercase letters in string to lowercase.
začať sa učiť
lower()
Removes all leading whitespace in string.
začať sa učiť
lstrip()
Returns a translation table to be used in translate function.
začať sa učiť
maketrans()
Returns the max alphabetical character from the string str.
začať sa učiť
max(str)
Returns the min alphabetical character from the string str.
začať sa učiť
min(str)
Replaces all occurrences of old in string with new or at most max occurrences if max given.
začať sa učiť
replace(old, new [, max])
Same as find(), but search backwards in string.
začať sa učiť
rfind(str, beg = 0, end = len(string))
Same as index(), but search backwards in string.
začať sa učiť
rindex(str, beg = 0, end = len(string))
Returns a space-padded string with the original string right-justified to a total of width columns.
začať sa učiť
rjust(width,[, fillchar])
Removes all trailing whitespace of string.
začať sa učiť
rstrip()
Splits string according to delimiter str (space if not provided) and returns list of substrings
začať sa učiť
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.
začať sa učiť
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.
začať sa učiť
startswith(str, beg=0, end=len(string))
Performs both lstrip() and rstrip() on string
začať sa učiť
strip([chars])
Inverts case for all letters in string.
začať sa učiť
swapcase()
Returns "titlecased" version of string, that is, all words begin with uppercase and the rest are lowercase.
začať sa učiť
title()
Translates string according to translation table str(256 chars), removing those in the del string.
začať sa učiť
translate(table, deletechars="")
Converts lowercase letters in string to uppercase.
začať sa učiť
upper()
Returns original string leftpadded with zeros to a total of width characters
intended for numbers, it retains any sign given (less one zero).
začať sa učiť
zfill (width)
Returns true if a unicode string contains only decimal characters and false otherwise.
začať sa učiť
isdecimal()
Converts string into lower case
začať sa učiť
casefold()
Returns True if the string is an identifier
začať sa učiť
isidentifier()
Returns a tuple where the string is parted into three parts
začať sa učiť
partition()
Splits the string at the specified separator, and returns a list
začať sa učiť
rsplit()
Splits the string at the specified separator, and returns a list
začať sa učiť
rsplit()
Returns a tuple where the string is parted into three parts
začať sa učiť
partition()
Returns a tuple where the string is parted into three parts
začať sa učiť
rpartition()
Removes prefix.
začať sa učiť
. removeprefix()
Removes suffix.
začať sa učiť
. removesuffix()

Ak chcete pridať komentár, musíte byť prihlásený.