Skip to content

Instantly share code, notes, and snippets.

@timlinux
Created April 17, 2013 02:37
Show Gist options
  • Save timlinux/5401376 to your computer and use it in GitHub Desktop.
Save timlinux/5401376 to your computer and use it in GitHub Desktop.
Interval
>>> x = 1.55566
>>> i = 0.33
>>> il = len(str(i).split('.')[1])
>>> il
2
>>> lx = len(str(x))
>>> xi = str(x).split('.')[0]
>>> xd = str(x).split('.')[1][:il]
>>> xstr = xi + '.' + xd
>>> xstr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment