python - How to print formatted string in Python3? -



python - How to print formatted string in Python3? -

hey have question concerning

print ("so, you're %r old, %r tall , %r heavy.") % ( age, height, weight)

the line doesn't work in python 3.4 know how prepare this?

you need apply formatting string, not homecoming value of print() function:

print("so, you're %r old, %r tall , %r heavy." % ( age, height, weight))

note position of ) closing parentheses. if helps understand difference, assign result of formatting operation variable first:

output = "so, you're %r old, %r tall , %r heavy." % (age, height, weight) print(output)

python string python-3.x

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -