Built-in string methods to help with validation.

  • isalnum
  • isalpha
  • isdigit
  • islower
  • isspace
  • istitle
  • isupper

Examples:

>>> 'abc d'.isupper()
False
>>> 'abc d'.islower()
True

Check if alphabet only characters. Note spaces will make this false.

'abc d'.isalpha()
False
>>> 'abcd'.isalpha()
True
>>> ' '.isspace()
True'
>>> ' \n\t'.isspace()
True
>>> 'a '.isspace()
False
>>> 'Abc Def'.istitle()
True
>>> 'Abc def'.istitle()
False