• 刚学python,这个一直显示数组越界怎么解决IndexError:
  • python
    1.00元

#随机选取一个真实用户
userIndex = random.randint(0,len(allUserLocation))
realUserLocation = allUserLocation[userIndex]
print(len(allUserLocation))
del allUserLocation[userIndex]
print(len(allUserLocation))

Traceback (most recent call last):
File "C:/Users/Zhang Liqiang/Desktop/lbs/lbs_algorithm/lbs_algorithm/test_algorithm/showAllUser_geohash.py", line 17, in 
realUserLocation = allUserLocation[userIndex]
IndexError: list index out of range


  • 就几件    2020-03-20 11:36:25
  • 阅读 2210    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信