Python - multiple %s string

python, string

Solution

Use a tuple:

TEXT = 'Hi, your first name is %s and your last name is %s' % (Fname, Lname)

Better: use `str.format(*args, **kwargs)`.

"Hi, your first name is {0} and your last name is {1}".format("foo", "bar")

Problem

how do you use multiple %s in a python output? ``` TEXT = 'Hi, your first name is %s' %Fname ``` This works fine but... ``` TEXT = 'Hi, your first name is %s and your last name is %s' %Fname %Lname ``` I get the error ``` TypeError: not enough arguments for format string ```

Original source