I want to strip double quotes from

我想从中删除双引号

string = '"" " " ""\\1" " "" ""'

to become

成为

string = '" " " ""\\1" " "" "'

I tried to use rstrip, lstrip and strip('[^\"]|[\"$]') but it did not work.

我尝试使用rstrip,lstrip和strip('[^ \“] | [\”$]')但它没有用。

How can I do this? Thank you for helping me.

我怎样才能做到这一点?感谢你们对我的帮助。

12 个解决方案

#1


140

If the quotes you want to strip are always going to be "first and last" as you said, then you could simply use:

如果你想要剥离的报价总是像你所说的那样是“第一个也是最后一个”,那么你可以简单地使用:

string = string[1:-1]

string = string [1:-1]

更多相关文章

  1. 如何使用Thymleaf做到这一点?

随机推荐

  1. PHP读取Excel文件的内容并写入Mysql数据
  2. 有多少MySQL行太多?
  3. PHP新的连接MySQL方法mysqli
  4. 使用GROUP BY,ORDER BY进行PDO查询构造
  5. mysql免安装版简单使用步骤
  6. 如何在MySQL中得到两个值的最大值?
  7. mysql replace into 的使用情况
  8. Centos设置开机启动Apache和Mysql[总结]
  9. MySQL添加外键错误1215
  10. 如何在执行bash查询时,获得受影响的行数?