我知道 Python 字典键中可以有空格,但这被认为是糟糕的编程吗?我在 PEP 中找不到任何与此相关的内容。
编辑以澄清:
在我正在做的一个项目中,我正在研究解析 Apache 的记分板输出的东西mod_status
(请参阅下面的示例输出。)我只是想找出最佳实践。我应该这样结束吗:
workers = {'W': 1,
'_': 9,
...}
or this:
workers = {'Sending Reply': 1,
'Waiting for Connection': 9,
...}
Example mod_status
output:
_....___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