クラスの辞書を値として、文字列をキーとして割り当てようとしています。メインループ内でそれらを出力するときは正しい値がありますが、メインループを離れるとすぐに、「cliStat」変数が「O」値で初期化されて表示されます..
これは、割り当てと印刷を行うコードの部分です。私の質問は、なぜ cliStat の値が「0」のままなのですか?
cliStat = {}
for org in client:
cliStat[ org ] = StatEntry( org, "0", "0", "0", "0", "0", "0", "0" )
self.getFilteredStat( client, date_debut, date_fin )
for statEntry in self.tabStatEntry.values():
cliStat[ statEntry.client ].nb_users += statEntry.nb_users
cliStat[ statEntry.client ].nb_pages = ( statEntry.nb_pages + cliStat[ statEntry.client ].nb_pages ) / 2
cliStat[ statEntry.client ].perf_rate = ( statEntry.perf_rate + cliStat[ statEntry.client ].perf_rate ) / 2
cliStat[ statEntry.client ].response_time = ( statEntry.response_time + cliStat[ statEntry.client ].response_time ) / 2
cliStat[ statEntry.client ].nb_errors = ( statEntry.nb_errors + cliStat[ statEntry.client ].nb_errors ) / 2
cliStat[ statEntry.client ].perf_globale = ( statEntry.perf_globale + cliStat[ statEntry.client ].perf_globale ) / 2
cliStat[ statEntry.client ].perf_server = ( statEntry.perf_server + cliStat[ statEntry.client ].perf_server ) / 2
cliStat[ statEntry.client ].perf_network = ( statEntry.perf_network + cliStat[ statEntry.client ].perf_network ) / 2
cliStat[ statEntry.client ].perf_redirect = ( statEntry.perf_redirect + cliStat[ statEntry.client ].perf_redirect ) / 2
for cle,val in cliStat.items():
print val
必要に応じて完全なコードを次に示します。http://dpaste.com/914508/
コードを実行する必要がある場合は、データ ファイルhttp://rapidshare.com/files/2185155450/meteo.7zを参照してください。
フォルダーで logDir 変数を変更するだけです。
ご覧いただきありがとうございます。