Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cope with numbers like "7,903,001" #8

Open
catherinedevlin opened this issue Mar 11, 2014 · 1 comment
Open

cope with numbers like "7,903,001" #8

catherinedevlin opened this issue Mar 11, 2014 · 1 comment

Comments

@catherinedevlin
Copy link
Owner

No description provided.

@hsum
Copy link

hsum commented Oct 30, 2014

Hi Catherine,

Would something like this help? It doesn't completely validate (maybe a regex would be needed to make sure commas separate 3 digits at time), but deals with the commas naively and that might be good enough.

numbers = [
    '1,234,000',
    '1,234,000.00',
    '1234000',
    '.4000',
    '1.4000',
    '1,4000',
    'wrongcolumn',
]

if __name__ == '__main__':
    for num in (n.replace(',','') for n in numbers):
        print(num, num.replace('.','').isdigit())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants