Mercurial > hg > GlobalNeighbors
comparison globalneighbors/neighbors.py @ 23:6891c5523b69
load with neighbors :)
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 25 Jun 2017 18:13:43 -0700 |
parents | e69cb496324e |
children |
comparison
equal
deleted
inserted
replaced
22:e69cb496324e | 23:6891c5523b69 |
---|---|
20 | 20 |
21 def read_neighbors_file(f): | 21 def read_neighbors_file(f): |
22 | 22 |
23 if isinstance(f, string): | 23 if isinstance(f, string): |
24 with open(f) as _f: | 24 with open(f) as _f: |
25 return read_neighbors_file(f) | 25 return read_neighbors_file(_f) |
26 | 26 |
27 retval = {} | 27 retval = {} |
28 for line in f: | 28 for line in f: |
29 key, value = line.split(None, 1) | 29 key, value = line.split(None, 1) |
30 key = int(key) | 30 key = int(key) |