Mercurial > hg > cc > cirrus_work
changeset 174:d88c8d40259a
put results in numbered subdirs
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Fri, 24 Nov 2023 19:52:14 +0000 |
parents | 10c87f5c704d |
children | 684370d1bf22 |
files | lib/python/cc/per_segment.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/python/cc/per_segment.py Fri Nov 24 19:50:12 2023 +0000 +++ b/lib/python/cc/per_segment.py Fri Nov 24 19:52:14 2023 +0000 @@ -6,7 +6,7 @@ Segment column is 0-origin ''' -import sys +import sys,os c=int(sys.argv[1]) @@ -29,7 +29,11 @@ # note this won't work if c is last column! for s in range(100): - with open('s%s.tsv'%s,'w') as f: + try: + os.mkdir(str(s)) + except FileExistsError: + pass + with open('%s/ks.tsv'%s,'w') as f: for (l,c) in sorted(ss[s].items(),key=lambda p:p[1],reverse=True): f.write(str(c)) f.write('\t')