Kumar
Kumar

Reputation: 799

String Conversion

s='This is sample'

i need to convert like this

s='"This is sample"'

output="This is sample"

how to do this in dynamic
Thanks in advance

Upvotes: 0

Views: 167

Answers (2)

mjv
mjv

Reputation: 75115

>>> s= 'This is a sample'
>>> s = '"' + s + '"'  # or s = '"%s"' % s
>>> s
'"This is a sample"'
>>> print(s)
"This is a sample"
>>>

Upvotes: 1

Johannes Charra
Johannes Charra

Reputation: 29913

orig = 'This is sample'
converted = '"%s"' % orig

Upvotes: 5

Related Questions