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]
Asked By: Python-97

||

Answers:

lst = ['4', '1,119']
print ([int(x.replace(',', '')) for x in lst])
Answered By: DSteman
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.