I'm trying to figure out how to use '%s'. I looked it up in the python docs but it never actually shows how to use it.

This is the line I'm working on right now just to figure it out. It is the first one of different variations where the location of the %s didn't give me an immediate syntax error and actually ran the code.

print('%sPlayer ', x %':') 

What I'm trying to do is get it to print out like this "Player x:" where x is an integer.

Edited by rbsmith333: Grammar

6 Years
Discussion Span
Last Post by rbsmith333

Both seem to work. So, if I understand this then, you put the first one where you want the value to appear in the string then the second one after the string followed by the value you want to be placed in the string? How would it work if you wanted to use more than one variable?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.