Python Forum

Full Version: what is " ''' "?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I started studying Python with book.
So, I followed what book says.
Book said, print sayings using ".
so I typed
print('Oscar Wild said, "Most of the time there's room for just one more on top"')
but it was wrong, so python printed error.
after some try and error, I pissed up. so I pressed ' three times, then Geany printed it green colors. I frightened, and i tried like
print('''Oscar Wild said, "Most of the time there's room for just one more on top"''')
then it worked.

I'm now cuiros what is '''@#$!'''.
What is its name? and what is its function?
Python will honor 3 types of quotes, the single ' ', the double " ", and the triple """ """:

print("""This is a multiĀ 
line quote""")
print("This is a single line quote. Escape character isn't needed")
print('This is a single line quote. Escape character it\'s needed')
Output:
This is a multiĀ  line quote This is a single line quote. Escape character isn't needed This is a single line quote. Escape character it's needed
Notice that the escape character is not needed for the apostrophe in "isn't" using double quotes, however it is when using the single quotes.

Other than that, Python doesn't care which you use, just be consistent.
Oh I see.
Thanks for answer very much.
my english is poor so i can't express well, but thank you.
(Sep-23-2017, 01:46 PM)yuisky Wrote: [ -> ]my english is poor so i can't express well,

Since I only speak one language and usually not well, I admire people who take time to learn other languages.