Check if a string contains a number

后端 未结 16 1627
無奈伤痛
無奈伤痛 2020-11-22 11:14

Most of the questions I\'ve found are biased on the fact they\'re looking for letters in their numbers, whereas I\'m looking for numbers in what I\'d like to be a numberless

16条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 12:00

    use

    str.isalpha() 

    Ref: https://docs.python.org/2/library/stdtypes.html#str.isalpha

    Return true if all characters in the string are alphabetic and there is at least one character, false otherwise.

提交回复
热议问题