使用Python出现的错误和解决方法

操作系统:Ubuntu16.04

错误代码(TypeError: object of type 'Quitter' has no len())

#-*-conding:utf-8-*-
while True:
    s = input('Enter something :')
    if s == 'quit':
        break
    print('length of the string is',len(s))
print('Done')

第一次使用Python运行的时候,版本不对,这样的代码如果用Python2运行就会出错,在Python3就不会。

猜你喜欢

转载自www.cnblogs.com/WuLiang-cola/p/8932146.html