Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to include " inside quotes?

Asked by
Aimarekin 345 Moderation Voter
6 years ago

Hello. Uh... It may look like a derp question, but, I can't figure out how to include a " inside two "" I mean, how do I do this?

print ("Im triying to include "these" into this text")

I thought of including the string into two ' ', but what if I want to include both simbols?

print ('I'm screwed up because I don't know what to "do"?')

I searched on the internet but I don't know how to express my problem in a sentence and didn't got results. Help?

3 answers

Log in to vote
1
Answered by
Tomstah 401 Moderation Voter
6 years ago

The best way to do this is using escape sequences. They'll always provide quotes, for sure.

print("   \"   ")  --This will print a single pair of quotation marks.
print("And what happened is, I said, \"Well what do you think?\" and then he said nothing!")
print('You can also use single quotes around " s and then concatenate as well.'
print('The value is "'..Value..'".'  

The last print would print: The value is "Value".

In conclusion, there's a metric ton of ways to getting around this, however, I still suggest the escape sequences first and foremost. Read more about it: Here.

Ad
Log in to vote
1
Answered by
thesit123 509 Moderation Voter
6 years ago

Use [[ and ]] instead of " or '...

print([[I like this movie called "The Move"]])
0
I think.. idk thesit123 509 — 6y
0
I may look idiot, but what if I wanna have [ ] " and ' at the same time? xD Is there a way to include them all? Or maybe I need to plus the strings, for example? Aimarekin 345 — 6y
0
For qoutes you are using [[ not [. So if you use only of [, and/or ], you will be fine. thesit123 509 — 6y
Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

I would do this:

print(“I’m trying to include ”.. ‘“‘.. these.. ‘“‘.. “into this text”)
0
Yeah, that's the most logical thing. Thanks! Aimarekin 345 — 6y
0
No problem cmgtotalyawesome 1418 — 6y

Answer this question