filmov
tv
Python tutorial #4 - Strings And String Methods
![preview_player](https://i.ytimg.com/vi/Pi8K74o7RLw/maxresdefault.jpg)
Показать описание
In this, you learned the ins and outs of Python string objects. You learned how to access different characters in a string using sub- scripts and slices, as well as how to determine the length of a string with len().
Strings come with numerous methods. The .upper() and .lower() methods convert all characters of a string to upper or lower case, respectively.
The .rstrip(), .lstrip(), and strip() methods remove whitespace from strings, and the .startswith() and .endswith() methods will tell you if a string starts or ends with a given substring.
You also saw how to capture input from a user as a string using the in- put() function, and how to convert that input to a number using int() and float(). To convert numbers, and other objects, to strings, you use str().
#python #pythonprogramming
Strings come with numerous methods. The .upper() and .lower() methods convert all characters of a string to upper or lower case, respectively.
The .rstrip(), .lstrip(), and strip() methods remove whitespace from strings, and the .startswith() and .endswith() methods will tell you if a string starts or ends with a given substring.
You also saw how to capture input from a user as a string using the in- put() function, and how to convert that input to a number using int() and float(). To convert numbers, and other objects, to strings, you use str().
#python #pythonprogramming