0

So I wish to print out "It's awesome" with the quotes

Note not print out It's awesome

Thanks a lot

Ancalagon BerenLuthien
  • 1,154
  • 6
  • 20
  • 29
  • 2
    And where is your Python code? – Raptor Mar 08 '18 at 02:19
  • Possible duplicate of [How to include a quote in a raw Python string?](https://stackoverflow.com/questions/4630465/how-to-include-a-quote-in-a-raw-python-string) – Charlie Mar 08 '18 at 03:41

4 Answers4

2

Escape your strings using \" or use single quotes '

print("\"It's awesome\"")
print('"It\'s awesome"')

If you don't wanna escape the quotes for some reason. Note that 34 is the ascii code for "

print("{}It's awesome{}".format(chr(34), chr(34)))
francium
  • 2,384
  • 3
  • 20
  • 29
1
>>> print("\"It's awesome\"")
"It's awesome"

Escape the quotes in the print statement

bigbounty
  • 16,526
  • 5
  • 37
  • 65
1

Escape quotes using \

If you are using a print statement. It should look something like this:

print("\"It's awesome\"")
hungersoft
  • 531
  • 4
  • 8
0

In addition, to the great answers mentioned here, you can also use a multiline-string without having to usually worry about escaping characters. :) . The way you can write this is by using triple quotes. For example, you can try something like:

print(r''' "It's awesome" ''')