Last active
April 14, 2017 20:50
-
-
Save AlexanderMike/4c2df9112b20e167e7fd6a74a79f6560 to your computer and use it in GitHub Desktop.
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
| import io | |
| #http://stackoverflow.com/questions/22459020/python-decode-utf-16-file-with-bom | |
| #https://docs.python.org/2/library/codecs.html | |
| #http://stackoverflow.com/questions/19644507/convert-different-encodings-to-ascii | |
| import io | |
| import os | |
| import math | |
| os.chdir('C:\Users\malexander\Dropbox\SFMC\Admin\Backups') | |
| filename = 'Subscriber_Master_Backup_ 20170411.csv' | |
| f = io.open(filename,encoding='utf-16-le') | |
| f2 = open('file.csv','wb') | |
| i = 0 | |
| for line in f: | |
| writeline = line.encode('utf8') | |
| f2.write(writeline) | |
| i += 1 | |
| if i % 1000 == 0: | |
| print i | |
| print line | |
| print writeline | |
| print i | |
| f2.close() | |
| f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment