Python - Descriptor 'split' requires a 'str' object but received a 'unicode'

后端 未结 3 2075
小鲜肉
小鲜肉 2021-02-20 14:26

Erm, I have ready-to-use code, and I\'m sure it really works, but I get the following error:

TypeError: descriptor \'split\' requires a \'str\' object but

3条回答
  •  忘了有多久
    2021-02-20 14:52

    Neither method worked when using isdigit. If you are in a similar solution, you could try a try-except block similar to

    try:
        output += filter(str.isdigit, some_string)
    except TypeError:
        output += filter(unicode.isdigit, some_string)
    

提交回复
热议问题