writing double quotes in python

后端 未结 3 478
面向向阳花
面向向阳花 2020-12-03 17:41

I would like to write the following in a text file in the following format:

The Name is from a list of names

Item \"Name\" RollNo

e.g

Item

3条回答
  •  星月不相逢
    2020-12-03 18:12

    You can also try the triple single quotes to have your string preserve the double quoted

    str = '''Item "Aaron" RollNo Item "Barry" RollNo'''

    output will be like this

    preserve the double quoted word in python string

提交回复
热议问题