Reputation:
I want to remove only 1214"
in "ilanlar\u0131 1214", "count""
or remove 2808"
in "ilanlar\u0131 2808", "count""
. How can I do by using regular expression in python?
I tried this code.
for line in fileinput.input('sektorler.json', inplace=True):
print(line.replace("^\d+\," , ""))
Upvotes: 2
Views: 64
Reputation: 174696
You need to use re.sub
which takes regex as first parameter. replace
method must take a string as parameter.
re.sub(r'\d+"', "", strin)
Upvotes: 2