Is there a pythonic way of splitting a number such as 1234.5678 into two parts (1234, 0.5678) i.e. the integer part and the decimal part?
1234.5678
(1234, 0.5678)
Use math.modf:
math.modf
import math x = 1234.5678 math.modf(x) # (0.5678000000000338, 1234.0)
1.4m articles
1.4m replys
5 comments
57.0k users