Skip to content

Instantly share code, notes, and snippets.

@akash-kd
Created September 7, 2022 09:25
Show Gist options
  • Select an option

  • Save akash-kd/426d4d85e89e8dd3adb8f85f7e64d2e0 to your computer and use it in GitHub Desktop.

Select an option

Save akash-kd/426d4d85e89e8dd3adb8f85f7e64d2e0 to your computer and use it in GitHub Desktop.
import csv
with open('data.csv', 'w', newline='') as csvfile:
csv = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv.writerow(['username','email'])
for i in range(1,6):
with open(r".\data{0}.txt".format(i), 'r') as fp:
# read line 8
x = fp.readlines()
username = x[714].split("username -:")[1].strip()
email = x[718].split("email -:")[1].strip()
csv.writerow([username,email])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment