Feb-04-2019, 01:32 PM
Hello,
I use three methods to replace "\xe2\x80\x9c and" "\xe2\x80\x9d" :
The first give me a good result
Thanks for help
I use three methods to replace "\xe2\x80\x9c and" "\xe2\x80\x9d" :
The first give me a good result
stripped = lambda s: "".join(i for i in s if 31 < ord(i) < 127) #en dur ça marche print(stripped('\xe2\x80\x9chttp://www.google.com\xe2\x80\x9d blah blah#%#@$^blah'))
Output:http://www.google.com blah blah#%#@$^blah
but the others not okfor line in fileinput.input('fic.txt'): #with exrp regu line1 = re.sub(r'[^\x00-\x7f]', r'', line.rstrip()) print(line1) #################### #with lambda print(stripped(line.rstrip()))
Output:\xe2\x80\x9chttp://www.google.com\xe2\x80\x9d blah blah#%#@$^blah
\xe2\x80\x9chttp://www.google.com\xe2\x80\x9d blah blah#%#@$^blah
I thank it's clear now.Thanks for help