Home > other >  Python character substitution problem
Python character substitution problem

Time:12-02

STR='{" CONTENT ":" hello, I want to query: anhui fangyuan special equipment technical development co., LTD., in 2018 the company has special equipment qualification is valid, ", "CONTENTTYPE" : 1, "DEPARTMENT" : "special equipment safety supervision", "INSERTDATE" : "2020-06-17", "PUBMESS" : 1, "PUBTIME" : "2020-06-24", "RESPEAT" : "please telephone counseling: 010-82261672,", "the ROWID" : 1, "SEP" : 4, "TITLE" : "fangyuan special equipment technical development co., LTD in anhui province", "USERNAME" : "the king left"}'

I want to get rid of the "SEP" : 4,
Use STR=STR. Replace (' "SEP" : 4, ', ') doesn't work, change how to solve?

CodePudding user response:

Print (STR) see as a result, there is the effect you want

CodePudding user response:

reference 1st floor chuifengde response:
print (STR) as a result, there is the effect you want

Thank you I have a test can be before is my Python

CodePudding user response:

reference 1st floor chuifengde response:
print (STR) as a result, there is the effect you want

If I put the string into a list, and then traverse the list at this time can't replace why replace?

CodePudding user response:

The replace will only replace the substring in a string, which can replace the string in the list

CodePudding user response:

The
reference 4 floor chuifengde reply:
replace will only replace the substring in a string, which can replace the string in the list of

For STR in STRS:
STR. The replace ()
Is that ok?

CodePudding user response:

For STR in STRS:
STR. The replace ()
Is that ok?
So I can
  • Related