Last active
September 25, 2025 03:56
-
-
Save hornc/8ab7c455f351e8f1ef96ec8623041a15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import csv | |
ABOUT = """ | |
Convert .csv (Comma Separated Value) file to .tsv (Tab Separated Value) file. | |
Output to STDOUT. (redirect to a file or another process) | |
""" | |
def main(): | |
parser = argparse.ArgumentParser(description=ABOUT) | |
parser.add_argument('csv', help='CSV file to convert') | |
args = parser.parse_args() | |
infile = args.csv | |
with open(infile, newline='') as csvfile: | |
csvreader = csv.reader(csvfile, delimiter=',') | |
for row in csvreader: | |
print('\t'.join(row)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
download and set
+x
to the script: