There are new format specifications, String Format Specification Mini-Language:
You can do the same as:
"{0:.2f}".format(1.42345) // output 1.42
Note that the above returns a string. In order to get as float, simply wrap with float(...):
float("{0:.2f}".format(1.42345)) // output 1.42