0% found this document useful (0 votes)
11 views1 page

String Methods

okayjsqw kfkjbhciuhisevfwiyevf wiegrwiueyrcwirc4urtvweuyrcveuytrvewuytrcveytrvceyugev3

Uploaded by

harsh.yadav15689
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

String Methods

okayjsqw kfkjbhciuhisevfwiyevf wiegrwiueyrcwirc4urtvweuyrcveuytrvewuytrcveytrvceyugev3

Uploaded by

harsh.yadav15689
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python String Methods

1. strings are immutable.


2. any method on string takes a copy of the object.
3. [Link] will convert the string to an upper case.
4. [Link] will convert the string to lower case.
5. [Link]("character") will strip the trailing characters of string.
6. [Link]("character/alphabets", "new character/alphabets") will replace the existing
specified alphabets in string with new ones.
7. [Link] splits the string at the given alphabet and returns a list of items.
8. [Link] capitalizes the first character of the word and turns rest all the characters to
lower case.
9. [Link] center aligns the string by adding the number of spaces mentioned in parenthesis.
10. [Link] counts the total number of a particular set of characters in a string.
11. [Link] checks whether a string ends with the specific characters.
12. [Link] finds the first occurrence of a given value and returns the index value of the position
of that occurrence.
13. [Link] finds the occurrence of a given value and returns the index value of the position;
however, if it is unable to find it, it will give an error causing the program to exit.
14. [Link] checks to find if string is alphanumeric and returns True or False.
15. [Link] checks if there are any numbers in the string.
16. [Link] checks if there are only lower alphabets in the string.
17. [Link] checks if all the characters are printable in the string (non printable characters
e.g \n).
18. [Link] checks if any space bar has been used in the string.
19. [Link] returns True only if the first letter of each word of the string is capitalized, else
False.
20. [Link] checks if all characters are uppercase in a string.
21. [Link] checks if a string starts with a given value.
22. [Link] converts uppercase to lowercase and vice versa in a string.
23. [Link] converts first character of all the words in the sentence to capital.

You might also like