Python String Methods - upper() lower() strip() find() replace() startswith() capitalize() + MORE

preview_player
Показать описание
There are several useful string methods

replace(old, new, count) - replace all old with new characters (up to count times)
find(x, start, end) – find x, starting at start ending at end
rfind(x) – reverse version of find()
count(x) – returns number of occurrences of x
isalnum()  – returns True if all characters are numbers or letters only
isdigit()  – returns True if all characters are the numbers
islower()  – returns True if all letters are lowercase
isupper()  – return True if characters are uppercase
isspace()  – Return True if all characters are whitespace
startswith(x)  – return True if the string starts with x
endswith(x)  – return True if the string ends with x
capitalize()  – Returns a copy of the string with the first character capitalized and the rest lowercase
lower()  – Returns a copy of the string with all lowercase characters
upper()  – Returns a copy of the string with all uppercase characters
strip()  – Returns a copy of the string with leading and trailing whitespace removed
title()  – Returns a copy of the string as a title, with first letters of words capitalized

String objects may be compared using relational operators, equality operators (==, !=), membership operators (in, not in), and identity operators (is, is not).

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Рекомендации по теме