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
How about this?
>>> s = '23.45678' >>> int(float(s)) 23
Or...
>>> int(Decimal(s)) 23
>>> int(s.split('.')[0]) 23
I doubt it's going to get much simpler than that, I'm afraid. Just accept it and move on.