Sulav Timsina Sulav Timsina - 1 year ago 83
Python Question

What is the alternate to \n in python?

I want to print the following output in python:

99 buckets of bits on the bus.
99 buckets of bits.
Take one down, short it to ground.
98 buckets of bits on the bus.


with a single print command and no "\n" characters in between. How can this be done?

Answer Source

With triple-quoted string literals, you can use actual newlines instead of \n.

print(""" 99 buckets of bits on the bus.
 99 buckets of bits.
 Take one down, short it to ground.
 98 buckets of bits on the bus.""")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download