Python: Convert Float in Scientific Notation to Int
Date: 2016-05-13 |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
**Problem: **I’ve got a bunch of large integers stored in a DB (a bunch of Twitter IDs), but when I used Python to access them, it automatically converted them to scientific notation. How do I get them from scientific notation back to their original forms?
**Solution: **
In order to convert from the scientific notation, simply cast them to an integer.
for scienceNum in scienceNums:
print int(scienceNum)
This should convert the e+17, or whatever form it gives you, back to the original large integer.
Want more like this?
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.