Created
March 18, 2013 19:49
-
-
Save kevin3/5190248 to your computer and use it in GitHub Desktop.
Simple python script to join every 4 lines and also misc formatting to get SCB transactions auto formatted as a csv file
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
#!/usr/bin/python | |
"""simple python script to join every 4 lines into one from a plain text file""" | |
data = open("SCBtransactions2013-03-19.orig.csv").readlines() | |
data = [ i.strip() for i in data ] #get rid of newlines | |
data = [ i.replace("\t \t","\t") for i in data ] #get rid of double tabs | |
data = [ i.replace("SGD","") for i in data ] #get rid of SGD | |
fourlines = range(0,len(data),4) | |
for num,line in enumerate(data): | |
if num in fourlines: | |
print ' '.join(data[num:num+4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment