Solution: What is %s in Python 3

Development | Programming languages
5.0 (2 ratings)
Description
What is %s in Python 3..?
Attachments
No attachments
Solutions
Description
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)
All coments
Thank you very much for the explanation.
on November 19th, 2018 (9:37 pm)
Good explanation.
on November 20th, 2018 (11:01 pm)
Good work. Thank you.
on January 01st, 2019 (5:41 pm)
You must sign in to comment!! LOGIN
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