Skip to content

Instantly share code, notes, and snippets.

@twosky2000
Created July 17, 2018 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twosky2000/d8a2bec7eccef03e64ba82733da8b97f to your computer and use it in GitHub Desktop.
Save twosky2000/d8a2bec7eccef03e64ba82733da8b97f to your computer and use it in GitHub Desktop.
Example of a Converter from EFS(ETS4) to yaml
mport csv
import yaml
from collections import OrderedDict
with open("test.csv", "r", encoding="ISO-8859-1") as csvfile:
reader = csv.reader(csvfile, delimiter='\t')
config = yaml.load("""
#test
ETS_Name: "bla"
""")
for indexR, row in enumerate(reader):
if (indexR == 0):
#print("Title: "+ str(row[0]))
#config.append({"ETS_Name":row[0]})
config["ETS_Name"]= row[0]
else:
print(indexR)
for indexC, colum in enumerate(row):
if (colum != ""):
config[indexR ][str(colum)]= "test"
#config["ETS_Name"][indexR+1]= tmpcol
print(config)
with open("test.yaml","w") as yaml_file:
yaml.dump(config,yaml_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment