![](/img/trans.png)
[英]how to text to dictionary text file into a dictionary where the keys are the lines of text and the values are line number
[英]How to get the text below <b> as values and text inside <b> as keys of a dictionary
<div>
<b> "Key1" </b>
" Value1 "
<br>
<b> "Key2" </b>
" Value2 "
<br>
<b> "Key3" </b>
" Value3 "
<br>
在這里,我需要將鍵作為 dict 'A' 中的鍵,並將值作為 A[keys] 的值
我剛剛嘗試了另一種方法,它正在起作用。
使用 zip() 函數制作字典;
data_dict = dict(zip(dict_keys,dict_values))
現在 data_dict 是包含鍵和值的必需字典
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.