+ 1

How can I replace something in a string in a list only if the string contains it

https://code.sololearn.com/czE9FgOD7IZ5/#py I want to remove the commas and my txt file contains integers that some of them contain a comma

2nd Jul 2018, 3:01 PM
David Gedalia Ordman
David Gedalia Ordman - avatar
1 ответ
+ 3
This should remove commas for you: content = [element.replace(",", "") for element in content]
3rd Jul 2018, 3:00 AM
John Wells
John Wells - avatar