String Functions in Python by codingxpertz

Veröffentlicht am: 01 Januar 1970
auf dem Kanal: Coding Xpertz
9
1

This time we’ll cover most of the string methods that you’ll ever need, that have not been
covered previously. I’ll display some examples with a brief explanation which should be self
explanatory.
CODE
Strings have many methods we can use beyond what I covered last time
rand_string = " this is an important string "


Delete whitespace on left
rand_string = rand_string.lstrip()


Delete whitespace on right
rand_string = rand_string.rstrip()


Delete whitespace on right and left
rand_string = rand_string.strip()


Capitalize the 1st letter
print(rand_string.capitalize())


Capitalize every letter
print(rand_string.upper())


lowercase all letters
print(rand_string.lower())
Lists will be covered in detail later, but I want to show them briefly here. This is how you turn a
list into a string and then separate each item with a space.


Auf dieser Seite können Sie das Online-Video String Functions in Python by codingxpertz mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Coding Xpertz 01 Januar 1970 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 9 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!