printing double quotes around a variable

前端 未结 7 1446
闹比i
闹比i 2020-11-29 11:50

For instance, we have:

word = \'Some Random Word\'
print \'\"\' + word + \'\"\'

is there a better way to print double quotes around a varia

7条回答
  •  感情败类
    2020-11-29 12:50

    You can try repr

    Code:

    word = "This is a random text" print repr(word)

    Output:

    'This is a random text'

提交回复
热议问题