What is the best way to execute awk
command below in Python 3?
awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", " ", $i) } 1' file1.csv > file2.csv
What is the best way to execute awk
command below in Python 3?
awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", " ", $i) } 1' file1.csv > file2.csv
Use the os
module to perform arbitrary commands from Python:
import os
os.system('do some command')
I'd use the subprocess module - check_output Example:
subprocess.check_output("awk...", shell=True)