Last change
on this file since 2578 was
2578,
checked in by nicholas, 18 years ago
|
improved CCS.py to handle not sorted files in a folder, Sorter.py. Created some double friction and building scenario scripts.
|
File size:
681 bytes
|
Line | |
---|
1 | |
---|
2 | |
---|
3 | def Sorter(B_list_unsorted) |
---|
4 | import os |
---|
5 | import string |
---|
6 | import operator |
---|
7 | |
---|
8 | B_list_unsorted=os.listdir("buildings_straight") |
---|
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 | |
---|
19 | for stt in B_strings: |
---|
20 | stt[1]=str(stt[1]) |
---|
21 | final=string.join(stt).replace(' ','') |
---|
22 | B_list.append(final) |
---|
23 | return B_list |
---|
Note: See
TracBrowser
for help on using the repository browser.