Python string [judgment] method

x.startswith()-----judging whether to start from [x], for example, whether the user enters the mobile phone number is 186:

Execute as follows

x.endswith()------judging whether it ends with 【x】

Execute as shown below

Combined judgment

x.isalpha()------Determine whether the string is all letters

Execute as shown below

x.isalnum()-----Determine whether the string is a letter or a number

Execute as shown below

x.isdigit()------Determine whether the number in the string is an integer

Execute as shown below

x.isidentifier()------judging whether the string is legal can be used as a variable name

Execute as shown below

x.islower()------Determine whether the string is all lowercase

Execute as shown below

x.isnumeric()---Judging the digital form in the string, different from isdigit can recognize various forms of numbers (such as Chinese, Roman numerals, etc.)

Execute as shown below

x.isprintable()----judging whether it can be printed

Execute as shown below

x.isspace()-----judging whether it is a space

Execute as shown below

x.istitle()-----judging whether the string is a title

Execute as shown below

x.isupper()-----judgment whether it is all uppercase

Execute as shown below

Guess you like

Origin blog.csdn.net/qq_42954795/article/details/127385852