Last change
on this file since 3322 was
2927,
checked in by nicholas, 19 years ago
|
final update of all relavent data
|
File size:
766 bytes
|
Line | |
---|
1 | """ Clunky sorting script to sort Nick Dando's sww files |
---|
2 | in a folder before being put through the CCS.py""" |
---|
3 | |
---|
4 | import os |
---|
5 | import string |
---|
6 | import operator |
---|
7 | |
---|
8 | B_list_unsorted=os.listdir("buildings_Str_half_Off") |
---|
9 | B_strings=[] |
---|
10 | B_list=[] |
---|
11 | for B_L in B_list_unsorted: |
---|
12 | A = B_L.split('=')[0] + '=' # first part of string |
---|
13 | B = float(B_L.split('=')[1].split('_')[0]) # middle part of string |
---|
14 | C = '_' + B_L.split('=')[1].split('_')[1] # last part of string |
---|
15 | B_current = [A,B,C]; B_strings.append(B_current) |
---|
16 | |
---|
17 | B_strings.sort(key=operator.itemgetter(1)) |
---|
18 | #B_strings.sort(lambda x, y: cmp(x[1],y[1])) |
---|
19 | |
---|
20 | for stt in B_strings: |
---|
21 | stt[1]=str(stt[1]) |
---|
22 | final=string.join(stt).replace(' ','') |
---|
23 | B_list.append(final) |
---|
24 | print B_list |
---|
25 | print "list sorted" |
---|
Note: See
TracBrowser
for help on using the repository browser.