0

How to put apostrophe ('s) in python?

Can anyone tell me the full syntax for getting output as BRIAN'S MOTHER in python?

15th Jan 2017, 8:07 AM
Vishal Srivastava
Vishal Srivastava - avatar
3 Respostas
+ 4
I can see 2 easy ways out: 1) Enclose the string in double quotes, so you can use apostrophes inside. example: "BRIAN'S MOTHER". 2)Use the "\" escape character to escape the apostrophe. example: "BRIAN\'S MOTHER". I very much prefer the second method, since the it doesn't matter whether you enclose it in double quotes or single quotes, it'll work fine.
15th Jan 2017, 8:17 AM
Dao
Dao - avatar
+ 1
in a print statment: print("BRIAN\'S MOTHER") in general use \' for apestophe
15th Jan 2017, 8:12 AM
Golan
0
kk
15th Jan 2017, 8:13 AM
Vishal Srivastava
Vishal Srivastava - avatar