Reputation: 83
I have a list:
a = ['1','2','4','3','7','5']
I want to convert str to int.
In fact, I want to write a function that multiplies a number in the list elements.
Upvotes: 0
Views: 779
Reputation: 332
To turn a string to an integer you can just use the built-in int(x)
function (see documentation).
To do it to your whole list try:
[int(x) for x in a]
Upvotes: 2