YouTip LogoYouTip

Python3 Check String

# Python3.x Python String Checking [![Image 3: Document Object Reference](#) Python3 Examples](#) The following code demonstrates Python string checking: ## Example # Filename : test.py # author by : www..com # Test Example One print("Test Example One") str=".com" print(str.isalnum())# Check if all characters are alphanumeric print(str.isalpha())# Check if all characters are alphabetic print(str.isdigit())# Check if all characters are digits print(str.islower())# Check if all characters are lowercase print(str.isupper())# Check if all characters are uppercase print(str.istitle())# Check if all words are titlecased (like a title) print(str.isspace())# Check if all characters are whitespace, t, n, r print("------------------------") # Test Example Two print("Test Example Two") str="" print(str.isalnum()) print(str.isalpha()) print(str.isdigit()) print(str.islower()) print(str.isupper()) print(str.istitle()) print(str.isspace()) Executing the above code produces the following output: Test Example OneFalseFalseFalseTrueFalseFalseFalse------------------------Test Example TwoTrueTrueFalseTrueFalseFalse [![Image 4: Document Object Reference](#) Python3 Examples](#)
← Go Data TypesGo Program Structure β†’