Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. ID DC_trip
  2. AC A9999
  3. SY DC,Foggy_bottom,22201,H_St.
  4. SY DC,Smithsonian,12345,14th_St.
  5. //
  6. ID ...
  7. AC ...
  8. SY ...
  9. SY ...
  10. SY ...
  11.  
  12. if lines.find('ID'):
  13. lines[5:]
  14. elif lines.find('SY'):
  15. lines[5:]
  16.  
  17. data = []
  18. # Extract the second row from the input file
  19. # and store it in data
  20. with open('input') as in_file:
  21. csv_reader = csv.reader(in_file, delimiter='t')
  22. for row in csv_reader:
  23. data.append(row[1])
  24.  
  25. # The first two values in data is the suffix
  26. # for the rest of your output file
  27. suffix = ','.join(data[:2])
  28.  
  29. # Append the suffix to the rest of the values
  30. # and write it out to the output file.
  31. with open('output') as op_file:
  32. for item in data[2:]:
  33. op_file.write('{},{}n'.format(suffix, item))
  34.  
  35. data = []
  36. with open('file1') as in_file:
  37. for line in in_file:
  38. data.append(line.strip().split())
  39. data = [a[1] for a in data if a[1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement