sales = ['$1.21', '$2.29', '$14.52', '$6.13', '$24.36', '$33.85', '$1.92']
print(sales.strip('$'))
basically any scenario where you are given values with the $ sign and you need them gone, what is the best way to get rid of the dollar sign 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']