Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what is " ''' "?
#1
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?
Reply
#2
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
Oh I see.
Thanks for answer very much.
my english is poor so i can't express well, but thank you.
Reply
#4
(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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020