I was trying to call sed
using subprocess.check_call
as follows
with open(output_file,'w+') as f:
subprocess.check_call(['sed', r':a;s/^\(\([^"]*,\?\|"[^",]*",\?\)*"[^",]*\),/\1 /;ta s/,$//; s/\.00//g; s/"//g', input_file], stdout = f, shell=True)
However, I got the such an error
'\"[^\"' is not recognized as an internal or external command, operable program or batch file.
The command sed ':a;s/^\(\([^"]*,\?\|"[^",]*",\?\)*"[^",]*\),/\1 /;ta s/,$//; s/\.00//g; s/"//g' input_file > output_file
works by itself in bash, so I suspect this is caused by some escaping problem.