Python For Beginner's Day - 7

·

2 min read

String Methods:

contd....

  • isalnum(): returns true if all the characters in the string are alphanumeric

  • isalpha(): returns true if all the characters in the string are only with alphabets(a - z)/(A-Z)

  • isdecimal(): returns true if all the characters in the string are in decimals(0 - 9)

  • isdigit(): returns true if all the characters in the string are digits same as isdecimal() but it also accepts subscript and superscript.

  • isnumeric(): returns true if all the characters in the string are Unicode characters which include digits same as isdecimal(), subscript, superscript, Roman Numerals and fractions.

  • isascii(): returns true if all the characters in the string are ascii characters. ASCII characters are those whose unicode points are in the range from 0 - 127

  • isidentifier(): returns true if the string is a valid identifier, like alphanumeric letters (a-z), (0-9) or underscores(_) but it should not start with a number or a space.

  • islower(): returns true if all the characters in the string are lower case.

  • isupper(): returns true if all the characters in the string are upper case.

  • isprintable(): returns true if all the characters in the string are printable, like digits(0-9), alphabets(A-Z)/(a-z), Space( ), Punctuation characters. Non-Printable characters include all escape characters such as '\n', '\t', ......

  • isspace(): returns true if all the characters in the string are whitespaces.

  • istitle(): returns true if each word start with upper case letter. Symbols and Numbers are ignored.

---To be continued......