Python: Convert Float in Scientific Notation to Int
Date: 2016-05-13 |
**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 / easiest way to support my work is by subscribing for future updates and sharing with your network.