Created
June 13, 2015 15:38
-
-
Save tkb77/0b08cc15ecffe4f315ea to your computer and use it in GitHub Desktop.
parameterPermutater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ログデータを書き換えるスクリプト | |
#変更するファイルのアドレス | |
editFileName = 'data' | |
#変更する内容 | |
permutString = 'x 0.0' | |
#変更するパラーメータの文字列 | |
targetString = 'x' | |
#変更するファイルを読み込む | |
editfile = open(editFileName,'r') | |
lines = editfile.readlines() | |
editfile.close() | |
#パラーメータの書き換え | |
for i,line in enumerate(lines): | |
if line.count(targetString): | |
lines[i] = permutString + '\n' | |
#書き換えたファイルの出力 | |
saveFileName = "Permuted_" + editFileName | |
savefile = open(saveFileName,'w') | |
savefile.writelines(lines) | |
savefile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment