Well I would atleast clean it up as follows:
print "%.2f kg = %.2f lb = %.2f gal = %.2f l" % (var1, var2, var3, var4)
More Related Contents:
- Most Pythonic way to print *at most* some number of decimal places [duplicate]
- How to use % symbol correctly
- How can I fill out a Python string with spaces?
- Python’s many ways of string formatting — are the older ones (going to be) deprecated?
- How to suppress scientific notation when printing float values?
- How to display a float with two decimal places?
- How can I format a decimal to always show 2 decimal places?
- How to properly round-up half float numbers?
- Format a datetime into a string with milliseconds
- round() doesn’t seem to be rounding properly
- What’s the difference between %s and %d in Python string formatting?
- Binary representation of float in Python (bits not hex)
- Convert floating point number to a certain precision, and then copy to string
- ValueError: could not convert string to float: id
- python floating number [duplicate]
- Add zeros to a float after the decimal point in Python
- Format strings vs concatenation
- Floating Point Limitations [duplicate]
- Logging variable data with new format string
- How to get Python to gracefully format None and non-existing fields [duplicate]
- numpy float: 10x slower than builtin in arithmetic operations?
- How to implement conditional string formatting?
- How do I escape curly-brace ({}) characters in a string while using .format (or an f-string)?
- Can Python’s logging format be modified depending on the message log level?
- Get the “bits” of a float in Python?
- How to convert escaped characters? [duplicate]
- What are some possible calculations with numpy or scipy that can return a NaN? [closed]
- How do you get the next value in the floating-point sequence? [duplicate]
- on what systems does Python not use IEEE-754 double precision floats
- Print a float number in normal form, not exponential form / scientific notation [duplicate]