String Methods

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

Lai ievietotu komentāru, jums jāpiesakās.