2

How can I print the " character?

I know that printing the % symbol is print "%%" but I do not know how to print the " character.

Jason
  • 2,278
  • 2
  • 17
  • 25
Mr T
  • 506
  • 2
  • 9
  • 26
  • 2
    Out of curiosity, what search terms did you try on Google? The above link was the first result I got for "python quotation mark". – Ben Mar 15 '16 at 01:31
  • You have to excuse my lack of English. I tried to search just typing the " symbol and nothing could came out. So silly... – Mr T Mar 15 '16 at 01:32
  • No problem - punctuation marks are notoriously difficult to search for if you don't know their name. – Ben Mar 15 '16 at 01:34
  • Symbolhound.com lets you search for symbols as well as words. – jkdev Mar 20 '16 at 12:34

2 Answers2

8

Just escape it:

print("\"")

Or as zondo mentioned:

print('"')

Even:

print("""""""")

(Triple double-quoted string with " inside)

print('''"''')

(Triple single-quoted string with " inside)

Output:

"

See this page.

Jason
  • 2,278
  • 2
  • 17
  • 25
4

There are two ways. Either escape the character with a backslash or use a different kind of quotation marks:

print("\"")

or

print('"')
zondo
  • 19,901
  • 8
  • 44
  • 83