There are several methods to perform this task but I personally recommend you to use ast.literal_eval It's the safe eval method to perform, check following code to your problem:
>>> import ast
>>> ast.literal_eval("121.555")
545.2222
>>> ast.literal_eval("21")
31
Mention your doubts in comments. Cheers....!!
To know more about this you can have a look at the following video tutorial:-
Learn more about Python from an expert. Enroll in our Python Course