随笔分类 - python
摘要:初学python,爬数据的时候报错<Response [200]> import requests url='https://club.jd.com/comment/productPageComments.action?callback=fetchJSON_comment98&productId=8
阅读全文
摘要:因为input输入的是字符型的,所以要转换一下,不然会报错 list= [8, 23, 45, 12, 78] int =0 while int!=1: str = input('输入数字获取序号:') if float(str) in list: print(list.index(float(st
阅读全文
摘要:1.python局部作用域引用错误。因为 test 函数中的 num使用的是局部,未定义,所以无法进行修改 num = 10 #全局定义 def test(): num = num+ 1 #局部未定义 print(anum) test() 2.改为 num = 10 #全局定义 def test()
阅读全文