TypeError: ‘str’ object cannot be interpreted as an integer

  • Post author:
  • Post category:其他


TypeError: ‘str’ object cannot be interpreted as an integer

python3 ,pycharm中运行

page = input(‘please enter the page: ‘)

for i in range(0, page):

报错

TypeError: ‘str’ object cannot be interpreted as an integer

input读取的类型是str(字符串),需要转换成int类型

page = int(input(‘please enter the page: ‘))

for i in range(0, page):



版权声明:本文为qq_38618269原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。