【发布时间】:2018-05-23 09:36:17
【问题描述】:
我有一本字典,其中包含 URLs 作为键,Open Ports 作为值。即dict200 = {}
dict200 = {}
{'http://REDACTED1.com': [21, 22, 80, 443, 3306], 'http://www.REDACTED2.com': [80, 443]}
现在我有了另一本不同内容的字典,即newerdict = {}
newerdict = {}
newerdict = {'Drupal , ': '7', 'Apache , ': '2.4.34'}
现在请假设 Apache 服务器在 redacted1 中使用,Drupal 在 redacted2 中使用。
现在我想要的是这样的:-
{'http://redacted1.com': [{'apache': '2.4.34' }], 'http://redacted2.com': [{'Drupal': '7'}]}
希望这次我解释得更好。正在寻找任何答复。
编辑:-
我能够以某种方式替换值的位置,但现在我面临的问题是,我无法在 dict 中访问 dict 的属性。
这是完整的输出,
http://redacted1.com : [{'\tApache (web-servers), ': '2.4.34'}]
http://redacted2.com : [{'\tDrupal (cms), ': '7'}]
但是我怎么打印
Apache = 2.4.34
【问题讨论】:
-
分享所需的输出,因为它不太清楚
-
你能写一个例子说明你的旧字典在完成你要求的事情后应该是什么样子吗?
-
好的,我会编辑这个。
-
请给我想要的输出,我可以给你看。因为它非常大。我不能给你看。 :(
标签: python python-2.7 dictionary