Consider:
print "%s is %d years old." % ('Meirav', 5)
What is the % operator between the string literal and the tuple called? Other than in the print statement, where else is it seen in Python?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s known as the “string formatting” or “interpolation” operator, and it’s used anywhere you might want to interpolate formatted data into a string.