Is it possible to do something like this (using python 3):
le = "\n"
var1 = 2
var2 = 5
print("INFORMATION"+le
"-----------"+le
"Variable1: {}".format(var1)+le
"Variable2: {}".format(var2)+le
)
Yes. take a look at docs.
General example:
var1 = 2
var2 = 5
print("INFORMATION",
"------------",
"Variable1: {}".format(var1),
"Variable2: {}".format(var2), sep='\n')
You could store this string in an object and then print it:
out = "INFORMATION"+le+"-----------"+le+"Variable1: {}".format(var1)+le+"Variable2: {}".format(var2)+le
print(out)
Or if you want to do it easier you can also do like that:
print("INFORMATION\n-----------\nVariable1: {}\nVariable2: {}\n".format(var1, var2))
Or if it is too long and you want to spare it in different lines in your code:
out = "Information\n" /
"-----------\n"
print("INFORMATION\n"
"-----------\n"
"Variable1: {}\n".format(var1),
"Variable2: {}".format(var2)
)
In [24]: print("INFORMATION"'\n'
....: "-----------"'\n'
....: "Variable1: {}\n".format(var1),
....: "Variable2: {}".format(var2)
....: )
INFORMATION
-----------
Variable1: 2
Variable2: 5
print("INFORMATION",
"-----------",
"Variable1: {}".format(var1),
"Variable2: {}".format(var2),
sep='\n')
In [30]: print("INFORMATION",
....: "-----------",
....: "Variable1: {}".format(var1),
....: "Variable2: {}".format(var2),
....: sep='\n')
INFORMATION
-----------
Variable1: 2
Variable2: 5