Created
September 7, 2022 09:25
-
-
Save akash-kd/426d4d85e89e8dd3adb8f85f7e64d2e0 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
| 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