I have a string in the format: \'nn.nnnnn\' in Python, and I\'d like to convert it to an integer.
Direct conversion fails:
>>> s = \'23.4567
>>> s = '23.45678' >>> int(float(s)) 23 >>> int(round(float(s))) 23 >>> s = '23.54678' >>> int(float(s)) 23 >>> int(round(float(s))) 24
You don't specify if you want rounding or not...