Last active
January 3, 2016 04:58
-
-
Save Verurteilt/8412175 to your computer and use it in GitHub Desktop.
Script para leer el csv de este gustavo, creado por mi putin
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 | |
| data = list() | |
| with open('Base.csv', 'rU') as f: | |
| reader = csv.DictReader(f, quotechar='|', quoting=csv.QUOTE_MINIMAL) | |
| for row in reader: | |
| for (k,v) in row.items(): | |
| z = k.replace('\t', ",") | |
| n = v.replace('\t', ",") | |
| num = {str(reader.line_num):(z.split(','), n.split(','))} | |
| data.append(num) | |
| for info in data: | |
| for line_num, data in info.iteritems(): | |
| try: | |
| to_insert_db = zip(data[0], data[1]) | |
| for combinations in to_insert_db: | |
| print combinations[0], combinations[1] | |
| except Exception as e: | |
| print "Eror en la linea", line_num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment