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 = 'Let's test this.'
# test to see if it is numeric
string_isnumeric = string.isnumeric()
Out [4]: AttributeError Traceback (most recent call last)
<ipython-input-4-859c9cefa0f0> in <module>()
3
4 # test to see if it is numeric
----> 5 string_isnumeric = string.isnumeric()
AttributeError: 'str' object has no attribute 'isnumeric'
The problem is that, as far as I can tell, str
DOES have an attribute, isnumeric
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…