Skip to content

Instantly share code, notes, and snippets.

@JackInTaiwan
Created September 11, 2017 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JackInTaiwan/c34219ac7d50d221b2a66eb002e7d7f5 to your computer and use it in GitHub Desktop.
Save JackInTaiwan/c34219ac7d50d221b2a66eb002e7d7f5 to your computer and use it in GitHub Desktop.
Python_convert science notation
def convert(num) :
num = str(num)
if ('e' in num):
index = num.index('e')
power = num[index+1::]
power = int(power)
num_num = num[:index]
output = '0.' + '0'*(abs(power)-1) + num_num
return (output)
else :
return (int(num))
a=0.00000000005
print (convert(a)) #0.00000000005 instead of 5e-11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment