Remove special characters from csv file using python

前端 未结 4 562
渐次进展
渐次进展 2021-01-14 08:11

There seems to something on this topic already (How to replace all those Special Characters with white spaces in python?), but I can\'t figure this simple task out for the l

4条回答
  •  忘掉有多难
    2021-01-14 08:23

    Maybe try

    s = open('myfile.cv','r').read()
    
    chars = ('$','%','^','*') # etc
    for c in chars:
      s = '_'.join( s.split(c) )
    
    out_file = open('myfile_new.cv','w')
    out_file.write(s)
    out_file.close()
    

提交回复
热议问题