Skip to content

Instantly share code, notes, and snippets.

@LadyKerr
Created August 23, 2023 02:11
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Convert TSV to CSV with Python - code generated by GitHub Copilot
import csv
with open('ruby-study-guide.tsv', 'r') as tsvfile:
reader = csv.reader(tsvfile, delimiter='\t')
with open('ruby-study-guide.csv', 'w') as csvfile:
writer = csv.writer(csvfile)
for row in reader:
writer.writerow(row)
@LadyKerr
Copy link
Author

To convert TSV to CSV with this script:

  • copy/paste the code to a file with the .py extension. For example, tsv_to_csv.py
  • add your TSV file in the same directory as the script
  • open your terminal and run python [[name of your file]]. For example, python tsv_to_csv.py and cick enter
  • Your CSV file will be automagically outputted in the same directory as your other files

A note:

I was able to generate this code with the help of GitHub Copilot Chat. See conversation below:

Screenshot 2023-08-22 at 9 15 32 PM

@LindaWhited
Copy link

LindaWhited commented Sep 12, 2023

This Python script utilizes the csv module to convert 'ruby-study-guide.tsv' into a CSV file ('ruby-study-guide.csv') while adjusting the delimiter for compatibility between formats. Explore the thrilling world of online casinos with Paradise 8 CasinoLogin. At https://casinosanalyzer.com/online-casinos/paradise8.com find out how to Paradise 8 CasinoLogin Whether you're a seasoned player or new to the scene, Paradise 8 CasinoLogin offers a diverse range of exciting games and exclusive offers. Dive into the action and experience top-notch entertainment. Join now to embark on a captivating casino journey, where the excitement never stops. Don't miss your chance to win big and enjoy endless hours of gaming fun. Paradise 8 CasinoLogin is your ticket to an unforgettable casino adventure. Join today and experience it for yourself!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment