请教各位大侠,问题如下
list_001 = [9.1454247, 53.48538079999999, 9.01548, 53.16778, 9.1434819, 53.4873555, 9.1451686, 53.48564990000001, 9.14256, 53.48726, 9.1393, 53.48882, 9.145203, 53.4865261, 9.1449977, 53.4899644, 9.1448787, 53.4857361, 9.14495, 53.48965, 9.145296799999999, 53.485342, 9.1447931, 53.4865513, 9.1454247, 53.48538079999999]
for num1 in range(1, len(list_001)):
k1 = list_001[num1][0]
k2 = list_001[num1][1]
print(num1)
print(k1)
print(k2)
运行结果报错是
File "C:\Python_3.6\Python_File_Py\EX_001\range_print.py", line 4, in <module>
k1 = list_001[num1][0]
TypeError: 'float' object is not subscriptable
请教大家应该怎么改正啊
<p>k1 = str(list_001[num])[0]</p>
k2 = str(list_001[num])[1]
但是不知道你要干嘛。。。。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。