I want to convert a list of python elements from str to int.
My initial list looks like this:
l1 = ['723', '124', '1,211', '356'] The code I tried:
l1 = list(map(int, l1)) Resulted in an error that tells me:
ValueError: invalid literal for int() with base 10: '1,211' Alternatively, I tried maping with float:
l1 = list(map(float, l1)) but, this also resulted in an error:
ValueError: could not convert string to float: '1,211' I have tried both int and float in the code using map function. Can anyone correct me on where I'm going wrong.
1,211supposed to be "1 point 211" or "1 thousand 211"?