Created
May 16, 2024 20:49
-
-
Save evanp/bbffcbe3b8fc2e3a2147f0171e479691 to your computer and use it in GitHub Desktop.
This file contains 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
from csv import DictReader as CSVReader | |
def csv2godot(csv_file, godot_file): | |
data = [] | |
with open(csv_file, 'r') as f: | |
reader = CSVReader(f) | |
for row in reader: | |
data.append(row) | |
with open(godot_file, 'w') as f: | |
f.write('[') | |
for row in data: | |
f.write('{') | |
for key, value in row.items(): | |
f.write(f"'{key}': '{value}', ") | |
f.write('},\n') | |
f.write(']') | |
if __name__ == '__main__': | |
import sys | |
csv2godot(sys.argv[1], sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment