How can I strip first and last double quotes?

后端 未结 13 1294
抹茶落季
抹茶落季 2020-12-02 10:14

I want to strip double quotes from:

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

to obtain:

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


        
13条回答
  •  猫巷女王i
    2020-12-02 10:50

    If you are sure there is a " at the beginning and at the end, which you want to remove, just do:

    string = string[1:len(string)-1]
    

    or

    string = string[1:-1]
    

提交回复
热议问题