Quantcast
Viewing all articles
Browse latest Browse all 4448

Better way to replace expressions in Regex

@syed.danish wrote:

Hi,
I am using following technique to replace expressions in regex :

def parse (x):
    x=re.sub('\?',',',str(x))
    x=re.sub('&',',',str(x))
    x=re.sub('\+',',',str(x))
    x=re.sub('/',',',str(x))
    x=re.sub('/',',',str(x))
    x=re.sub(':',',',str(x))
    x=re.sub(';',',',str(x))
    x=re.sub('\*',',',str(x))
    x=re.sub('%',',',str(x))
    x=re.sub('$',',',str(x))
    return re.split(',',str(x))
skill=skill.apply(parse)

Can somebody please suggest a better way to replace the expressions as shown in above code.
Thanks

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles