0

string

how to create a string containing a double quote

6th Jul 2017, 4:08 AM
PRASHANTH C B
PRASHANTH C B - avatar
4 odpowiedzi
+ 12
a=""" "thing" """ #three quotes make it so anything inside it is a string print(a) a=' "idk" ' #you can use ' in place of " for the container print(a) a=" \"lol\" " #you can use \ behind " to include it in the string print(a) https://code.sololearn.com/crMwXSnEy5e2/?ref=app
6th Jul 2017, 4:26 AM
Ahri Fox
Ahri Fox - avatar
+ 3
by using backslash followed by "
6th Jul 2017, 4:26 AM
Vaibhav Tandon
Vaibhav Tandon - avatar
0
Use single quotes as the outer quotes or escape the double quote. 'you can use a "double" like this' "Or with outer double \" quotes like this"
6th Jul 2017, 4:20 AM
ChaoticDawg
ChaoticDawg - avatar
0
What @Ahri Fox did there with the 3 qoutes is known as a python string literal FYI. 😉
6th Jul 2017, 4:29 AM
ChaoticDawg
ChaoticDawg - avatar