When I am trying to print a string like the one below which uses an apostrophe in the sentence,
print(''I am jack's raging bile duct'')
I get a syntax error. How to fix this?
When I am trying to print a string like the one below which uses an apostrophe in the sentence,
print(''I am jack's raging bile duct'')
I get a syntax error. How to fix this?
You can use both " and ' to write a string in Python, a double ' ('') will be invalid.
If you use ", the syntax for your case would be
print("I am jack's raging bile duct")
But if you use ', you may need to escape the apostrophe as follows:
print('I am jack\'s raging bile duct')
In general, if you use ", and your string has also ", you will need to escape every " in your string, except the one that closes, same happens with '.
There are 2 ways:
print('I am jack\'s raging bile duct')
or:
print("I am jack's raging bile duct")
Don't use double ', use ".
print("'I am jack's raging bile duct'")
Use of double quotes will do the trick. print("I am jack's raging bile duct") I tried it and works good. Happy coding!
you have 3 way:
in general you just can use different of mark it maean use " in ' OR use ' in ".