Advertisement
Guest User

debugging

a guest
Sep 1st, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. import pdb
  2.  
  3. def short_ids(short_id_file):
  4.     """This function expects a short_id file and returns a list with all
  5.    short_ids."""
  6.     short_id_list = []
  7.     invalid_ids = []
  8.     with open(short_id_file) as data_file:
  9.         for line in data_file:
  10.             short_id = line.strip('\n')
  11.             if len(short_id) == 10:
  12.                 short_id_list.append(line.strip('\n'))
  13.             else:
  14.                 invalid_ids.append(short_id)
  15.     print 'Total of IDs in the file: {}.'.format(
  16.         len(short_id_list) + len(invalid_ids))
  17.     pdb.set_trace()
  18.     print 'InvalidIDs: {}'.format(len(invalid_ids))
  19.     print 'Valid IDs to downlaod: {}'.format(len(short_id_list))
  20.     data_file.close()
  21.     short_id_list = short_id_list
  22.     return short_id_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement