Why isn't isnumeric working?

前端 未结 4 1884
孤城傲影
孤城傲影 2020-12-17 09:25

I was going through a very simple python3 guide to using string operations and then I ran into this weird error:

In [4]: # create string
        string = \'L         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 09:59

    One Liners:

    unicode('200', 'utf-8').isnumeric() # True
    unicode('unicorn121', 'utf-8').isnumeric() # False
    

    Or

    unicode('200').isnumeric() # True
    unicode('unicorn121').isnumeric() # False
    

提交回复
热议问题