Last active
December 19, 2015 09:39
-
-
Save webbyfox/5935141 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 csv | |
from datetime import date | |
#filename = date.today().strftime("%d-%m-%Y") | |
filename = '22467279624.txt' | |
country_list = { | |
'GB': 'UK', | |
'DE': 'GERMANY', | |
'IT': 'ITALY', | |
} | |
fonemaster_sku = ['LV-S5DQ-ES97','8R-371B-YQOT','6L-7DO8-ZC33','3N-UPVX-N1ZJ','II-D56Z-W2EU'] | |
asin_description = {'LV-S5DQ-ES97':'S3 - White Handsfree', | |
'8R-371B-YQOT':'S3 - White Handsfree', | |
'6L-7DO8-ZC33':'S3 - BLACK Handsfree', | |
'3N-UPVX-N1ZJ':'S3 - White Handsfree', | |
'II-D56Z-W2EU':'S3 - White Handsfree', | |
} | |
#c = csv.writer(open(str(filename) + '.csv', "wb")) | |
#c.writerow(["Name","Address","Telephone","Fax","E-mail","Others"]) | |
with open(filename,'rw') as tsv: | |
order_list = [line.strip().split('\t') for line in tsv] | |
for row in order_list: | |
if row[10] in fonemaster_sku: | |
message = '\n' | |
message += row[12] + ' X ' + asin_description[row[10]] | |
if row[15] == 'Expedite': | |
message += '(NEXT DAT DELIVERY)' | |
message += '\n' | |
if row[16]: | |
message += '\n' + row[16] | |
if row[17]: | |
message += '\n' + row[17] | |
if row[18]: | |
message += '\n' + row[18] | |
if row[19]: | |
message += '\n' + row[19] | |
if row[20]: | |
message += '\n' + row[20] | |
if row[21]: | |
message += '\n' + row[21] | |
if row[22]: | |
message += '\n' + row[22] | |
if country_list[row[23]]: | |
message += '\n' + country_list[row[23]] | |
else: | |
message += '\n' + row[23] | |
message += '\n\n' + "----------------------------------------------------" | |
print message | |
del row |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment