Not able to print statements with 'Apostrophe' in it in Python. Invalid syntax error

时光毁灭记忆、已成空白 提交于 2019-11-29 09:32:28

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 '.

don't use double ', use "

print("'I am jack's raging bile duct'") should work

There are 2 ways:

print('I am jack\'s raging bile duct')

or:

print("I am jack's raging bile duct")

'' is not a double quote.
You want ".

Use of double quotes will do the trick. print("I am jack's raging bile duct") I tried it and works good. Happy coding!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!