Advertisement
Guest User

Untitled

a guest
Apr 24th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. FIELDS ={'rdf-schema#label': 'label',
  2.          'URI': 'uri',
  3.          'rdf-schema#comment': 'description',
  4.          'synonym': 'synonym',
  5.          'name': 'name',
  6.          'family_label': 'family',
  7.          'class_label': 'class',
  8.          'phylum_label': 'phylum',
  9.          'order_label': 'order',
  10.          'kingdom_label': 'kingdom',
  11.          'genus_label': 'genus'}
  12.  
  13.  
  14. def process_file(filename, fields):
  15.  
  16.     process_fields = fields.keys()
  17.     data = []
  18.     with open(filename, "r") as f:
  19.         reader = csv.DictReader(f)
  20.         print process_fields
  21.         for i in range(3):
  22.             l = reader.next()
  23.  
  24.         for line in reader:
  25.             for col in process_fields:
  26.                 fields[col].append(col)
  27.                 print line[col]
  28.            
  29.            
  30.            # data.append(FIELDS)
  31.  
  32.  
  33. File "/tmp/vmuser_hycrxztfsk/processing.py", line 70, in process_file
  34.     fields[col].append(col)
  35. AttributeError: 'str' object has no attribute 'append'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement