How to convert Nonetype to integer?
Question:
This value exists in the list.
list = ['4', '4', '4', '1,119', '1,119', '1,119']
i try convert Nonetype to int.
list = ['4', '4', '4', '1,119', '1,119', '1,119']
for i in list :
a = [int(x.replace(',', '')) for x in list]
print(set(list))
TypeError: 'NoneType' object is not iterable
i want output
list = [4,1119]
Answers:
lst = ['4', '1,119']
print ([int(x.replace(',', '')) for x in lst])
This value exists in the list.
list = ['4', '4', '4', '1,119', '1,119', '1,119']
i try convert Nonetype to int.
list = ['4', '4', '4', '1,119', '1,119', '1,119']
for i in list :
a = [int(x.replace(',', '')) for x in list]
print(set(list))
TypeError: 'NoneType' object is not iterable
i want output
list = [4,1119]
lst = ['4', '1,119']
print ([int(x.replace(',', '')) for x in lst])