我知道你可以在 Python 字典键中有空格,但这被认为是糟糕的编程吗?我在 PEP 中找不到任何关于此的内容。
编辑澄清:在我正在做的一个项目中,我正在做一些分析来自 Apache 的记分牌输出的东西mod_status
(参见下面的示例输出。)我只是想找出最佳实践。我是否应该这样结束:
workers = {'W': 1,
'_': 9,
...}
或这个:
workers = {'Sending Reply': 1,
'Waiting for Connection': 9,
...}
示例mod_status
输出:
_....___W____._.................................................
................................................................
................................................................
................................................................
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process