TypeError: ‘list’ object cannot be interpreted as an integer
Wrong type, cannot convert list object to an integer
Error code, such as the following example:
args=[3,6]
print(list(range(args)))
the range function should require an integer, or a pair of ranges, or three integer types to construct an iteratable. It is not possible to directly pass the args list to it. It needs to be decompressed. After correction, the code is as follows:
args=[3,6]
print(list(range(*args)))#callwithargumentsunpackedfromalist
use * args to decompress the list and pass it to range to construct an itetable
Similar Posts:
- Python TypeError: ‘int’ object is not iterable
- How to Solve Python TypeError: ‘list’ object is not callable
- How to Solve Error: TypeError int object is not iterable
- TypeError: list indices must be integers or slices, not str
- [Solved] An error occurred when paddlepaddle iterated data: typeerror: ‘function’ object is not iterative
- [Solved] Spark Streaming:updateStateByKey is not applicable for the arguments…
- [Solved] Python TypeError: sequence item 0: expected str instance, int found
- Convert Object to List>, avoiding Unchecked cast: ‘java.lang.Object’ to ‘java.util.List
- Python TypeError: can only concatenate str (not “int”) to str
- Fast locating nonetype ‘object is not Iterable in Python