Solution: What is %s in Python 3

Development | Programming languages
  • 5.0 (2 ratings)
Last updated 11/2018
Author
Description
What is %s in Python 3..?
Attachments
No attachments.
Solutions
It is a string formatting syntax (which it borrows from C).
name = "John"
print("hello %s" % (name,))
name = "John"
surname = "Smith"
age = "37"

print("%s %s %s\n" % (name, surname, age))

on November 19th, 2018 (9:33 pm)
What masters said
You must sign in to comment!!
All comments
Thank you very much for the explanation.
on November 19th, 2018 (9:37 pm)
Good explanation.
on November 20th, 2018 (11:01 pm)
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out more Accept