某字符串要在paramiko远程命令中使用

我的字符串格式是
string = 'aaaaa \'this is single quote\' \\"this is double quote\\"'

想保留的双引号用两个反斜线转义以保留
我希望在字符串中保留单引号和双引号 因此在最外层用单引号''引起来


在paramiko中使用时
client.exec_commond('echo "%s" > aa.log' % string)

相关文章:

  • 2021-12-14
  • 2021-11-18
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-23
  • 2022-12-23
  • 2021-10-20
  • 2022-02-15
  • 2021-08-11
相关资源
相似解决方案