I'm having trouble understanding newlines with triple quotes. Python automatically runs the script when you press enter, so how are you supposed to use it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm having trouble understanding newlines with triple quotes. Python automatically runs the script when you press enter, so how are you supposed to use it?

14th Feb 2017, 4:13 AM
JustWokeUp
JustWokeUp - avatar
2 Answers
+ 2
Triple quotes allows the programmer to create a multi line string. This is useful when the programmer needs to give some form of an explanation or elaborate on a point that's more than just a line. Now I assume you're invoking the interpreter via the shell or whatnot, because it is a REPL like environment it will execute once you press enter but that's nothing to worry about. The shell is really only for testing snippets of code, you would use such things within your actual script (the file).
14th Feb 2017, 4:21 AM
Don
Don - avatar
0
You should use an editor for writing scripts rather than shell. Python even provides an built-in IDE for this purpose.
14th Feb 2017, 5:30 AM
Varun Moghe
Varun Moghe - avatar