Created
April 13, 2021 13:02
-
-
Save grenzi/f73352c3e87d5ab847896b972a3ccb7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import locale, string | |
n = ['$1,234.56','-$1,234.56','($1,234.56)', '$ -1,234.56'] | |
tbl = str.maketrans('(', '-', '$),') | |
[locale.atof( x.translate(tbl)) for x in n] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment