I was looking at this post, but I don't have the privilege to add a comment. My question is: > results = [int(i) for i in results] >>> results = ['1', '2', '3'] >
Solution 1:
Just simply write:
results[1] = int(results[1])
To change first element:
results[0] = int(results[0]) #because of 0 based indexing
Generally :
results[index] = int(results[index])
Share
Post a Comment
for "Changing One Element In A List From String To Integer"
Post a Comment for "Changing One Element In A List From String To Integer"