Tuesday, 4 February 2020

Python String Methods ( Functions )

Popular Python String Methods ( Functions )


        Method         Description
  1. count() It returns the number of times a specified value occurs in a string
  2. capitalize() It converts the first character of a string into upper case
  3. casefold()   Converts string into lower case
  4. endswith() Returns true if the string ends with the specified value
  5. find() Searches the string for a specified value and returns the position of where it was found
  6. index() Searches the string for a specified value and returns the position of where it was found
  7. isdigit()        Returns True if all characters in the string are digits
  8. islower()      Returns True if all characters in the string are lower case
  9. isalnum()     Returns True if all characters in the string are alphanumeric
  10. isalpha()      Returns True if all characters in the string are in the alphabet
  11. isdecimal() Returns True if all characters in the string are decimals
  12. isspace()      Returns True if all characters in the string are whitespaces
  13. istitle()        Returns True if the string follows the rules of a title
  14. isupper()      Returns True if all characters in the string are upper case
  15. join() Joins the elements of an iterable to the end of the string
  16. ljust() Returns a left justified version of the string
  17. lower() Converts a string into lower case
  18. upper() Converts a string into upper case
  19. lstrip()         Returns a left trim version of the string
  20. replace()      Returns a string where a specified value is replaced with a specified value
  21. rsplit()         Splits the string at the specified separator, and returns a list
  22. rstrip()         Returns a right trim version of the string
  23. startswith() Returns true if the string starts with the specified value
  24. swapcase() Swaps cases, lower case becomes upper case and vice versa
  25. title() Converts the first character of each word to upper case
  26. strip() Returns a trimmed version of the string



No comments:

Post a Comment