Python error handling experience: python3 in error, TypeError: 'range' object does not support item assignment

1 error for the following reasons:
try to use the range () 
to create a list of integers (resulting in "TypeError: 'range' object does not support item assignment") Sometimes you want to get an ordered list of integers, so the range () appears to be generated this list is a good way. However, you need to remember range () returns "range object", rather than the actual value of the list.

Solution 2:
The above example of the code: a = range (0, N ) to a = list (range (0, N)) Jiuhaola!

Reference links

https://blog.csdn.net/wanglin_lin/article/details/50819657
----------------
Disclaimer: This article is CSDN blogger "furuit 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/fu6543210/article/details/79920268

Guess you like

Origin www.cnblogs.com/lizhen416/p/11521458.html