-
-
Save sw82/142bfb8e3b338ce2eff3ceb0e2d3bed1 to your computer and use it in GitHub Desktop.
convert each row in csv to a markdown file in python
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 | |
| # Name,Contact made by,Rating,Service Area,Last Catchup,Notes | |
| def toMarkdown(item): | |
| #print(item) | |
| newTemp = "# About"+"\n"+"\n" | |
| newTemp += "- Intro via [["+f"{item['Contact made by']}"+"]]"+"\n"+"\n" | |
| newTemp += "- #Rating"+f"{item['Rating']}"+"\n"+"\n" | |
| newTemp += "# Tags"+"\n"+"- #" +f"{item['Service Area']}"+"\n"+"\n" | |
| #newTemp += "# Notes"+"\n" +"- " +f"{item['Notes']}" +"\n" | |
| return newTemp | |
| with open('test.csv') as f: | |
| reader = csv.DictReader(f) | |
| for row in reader: | |
| #print(f"{row['Name']}") | |
| with open(f"{row['Name']}" + '.md', 'w') as output: | |
| output.write(toMarkdown(row)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment