Commit 362c9d37a9e82b861d794ffc9dd11cd43d066cce
1 parent
1d8b79f614
Exists in
master
Fixed simple issue
Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff
volia/masseffect.py
... | ... | @@ -99,8 +99,9 @@ |
99 | 99 | with open(outfile, "w") as of: |
100 | 100 | key_2_subkeys = {} |
101 | 101 | for subkey in keys: |
102 | - key = subkey.replace(" ", "").replace("\n", "").split("_")[:-1] | |
103 | - key_2_subkeys[key] = [] | |
102 | + key = "_".join(subkey.replace(" ", "").replace("\n", "").split("_")[:-1]) | |
103 | + if key not in key_2_subkeys: | |
104 | + key_2_subkeys[key] = [] | |
104 | 105 | key_2_subkeys[key].append(subkey) |
105 | 106 | |
106 | 107 | for key in key_2_subkeys: |
... | ... | @@ -114,7 +115,7 @@ |
114 | 115 | |
115 | 116 | with open(outfile, "w") as of: |
116 | 117 | for subkey in keys: |
117 | - key = subkey.replace(" ", "").replace("\n", "").split("_")[:-1] | |
118 | + key = "_".join(subkey.replace(" ", "").replace("\n", "").split("_")[:-1]) | |
118 | 119 | of.write(f"{subkey} {key}\n") |
119 | 120 | |
120 | 121 |