[Solved] How can I remove dollar signs ‘$’ from a list in Python?


Strip from the left with str.lstrip():

>>> sales = ['$1.21', '$2.29', '$14.52', '$6.13', '$24.36', '$33.85', '$1.92']
>>> [s.lstrip("$") for s in sales]
['1.21', '2.29', '14.52', '6.13', '24.36', '33.85', '1.92']

1

solved How can I remove dollar signs ‘$’ from a list in Python?