Need some help with Python string formatting
I have two code:
a = "Hello"
b = False
p = "Python rocks"
q = True
I want to print a,b,p & q like this:
Hello ................................. False
Python rocks .......................... True
The total length of each line (From Hello to False) is fixed say 70 chars.
(edit) Following was being tried. Clearly not a good way (and incorrect), hence the question
arr = [ ["Hello", False], ["Python rocks", True]]
totallen = 70
for e in arr:
result = "{0}".format(e[1])
dottedlen = totallen - len(e[0]) - len(result) - 2
dottedstr = "." * dottedlen
str = "".join([e[0], " ", dottedstr, " ", result])
print str