s ='这是样本'
我需要像这样转换
s='"This is sample"'
输出= "This is sample"
如何在动态中做到这一点 提前致谢
答案 0 :(得分:5)
orig = 'This is sample'
converted = '"%s"' % orig
答案 1 :(得分:1)
>>> s= 'This is a sample'
>>> s = '"' + s + '"' # or s = '"%s"' % s
>>> s
'"This is a sample"'
>>> print(s)
"This is a sample"
>>>