srajappa
srajappa

Reputation: 481

Filtering a string based on some group of characters

I would like to filter the string mentioned below in python.

u'reviews': [{u'content':

Can someone please let me know to how I should create a new string like this below.

reviews: [{content:

I am aware that python provides an excellent patter matching technique but don't know how it works. Thanks in advance

Upvotes: 1

Views: 59

Answers (1)

vks
vks

Reputation: 67968

import re
x="u'reviews': [{u'content':"
print re.sub(r"u'([^']*)'",r"\1",x)

You can use re.sub for this.

Upvotes: 1

Related Questions