Repulblicado de stackoverflow.com/print-multiple-arguments-in-python
Pass it as a tuple:print("Total score for %s is %s " % (name, score))Or use the new-style string formatting:print("Total score for {} is {}".format(name, score))Or pass the values as parameters and print will do it:print("Total score for", name, "is", score)If you don't want spaces to be inserted automatically by print, change the sep parameter:print("Total score for ", name, " is ", score, sep='')If you're using Python 2, you won't be able to use the last two because print isn't a function in Python 2. You can, however, import this behavior from __future__:from __future__ import print_function
Comentários