Skip to content

Instantly share code, notes, and snippets.

@brianbancroft
Forked from mrmch/for_brian.py
Last active December 31, 2015 21:09
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 brianbancroft/8045369 to your computer and use it in GitHub Desktop.
Save brianbancroft/8045369 to your computer and use it in GitHub Desktop.
I've played around with the file, learnt a few new things and still am drawing a bit of a blank.
fname = 'C:\\Temp\\SIC_Core.txt'
ofname = 'C:\\Temp\\SIC_Fixed.txt'
with open(fname, 'r') as ifile:
input = ifile.readlines(-1)
with open(ofname, 'w') as ofile:
i = 0
while i < len(input):
line = str(input[i])
i = i + 1
next_line = str(input[i])
new_line = '"%s":"%s",\n' %(line.strip('\n'), next_line.strip('\n'))
ofile.write(new_line)
i = i + 1
@brianbancroft
Copy link
Author

I've figured this one out, when I had to revisit it. Very straightforward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment