Having both single and double quotation in a python string

后端 未结 6 617
悲&欢浪女
悲&欢浪女 2020-11-29 09:19

Hi I\'m trying to have a string that contains both single and double quotation in python -- (\'\"). The reason I need this expression is to use as an input to some external

6条回答
  •  鱼传尺愫
    2020-11-29 09:42

    To add both the single and double quote on python use screened (escaped) quotes. Try this for example:

    print(" just display ' and \" ")
    

    The \" tells python this is not the end of the quoted string.

提交回复
热议问题