How to remove quotes from string in Python

3 Answers

0 votes
s = '"python"'

new_string = s.replace('"', '')

print("{}".format(s))
print("{}".format(new_string))

  
  
  
'''
run:
  
"python"
python

'''

 



answered Apr 13, 2021 by avibootz
0 votes
s = '"python"'

new_string = s.strip('"')

print("{}".format(s))
print("{}".format(new_string))

  
  
  
'''
run:
  
"python"
python

'''

 



answered Apr 13, 2021 by avibootz
0 votes
s = '"python"'

new_string = eval(s)

print("{}".format(s))
print("{}".format(new_string))

  
  
  
'''
run:
  
"python"
python

'''

 



answered Apr 13, 2021 by avibootz

Related questions

1 answer 119 views
1 answer 141 views
1 answer 123 views
1 answer 138 views
1 answer 128 views
1 answer 132 views
2 answers 226 views
...