Convert comma-separated value (CSV) files to SC format with #Python
#!/usr/bin/env python3
import sys,string
d=','
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
r=0
o=[":"]
for l in open(sys.argv[1]):
c=0
for p in l.rstrip().split(d):
if not p:continue
try:
o+=["let %s%d = %d"%(a[c],r,int(p))]
except:
o+=["leftstring %s%d = %s"%(a[c],r,p if p[0]=='"' else '"%s"'%p)]
c+=1
r+=1
print("\n".join(o))
