<p>好吧,这看起来不漂亮,但很管用。
我把你的列表转换成了一个字符串:</p>
<pre><code>import re
import pandas as pd
x = """[(deliveryObject){
id = "0bf003ee0000000000000000000002a11cb6"
start = 2019-01-02 09:30:00
messageId = "68027b94b892396ed29581cde9ad07ff"
status = "sent"
type = "normal"
}, (deliveryObject){
id = "0bf0BE3ABFFDF8744952893782139E82793B"
start = 2018-12-29 23:00:00
messageId = "0bc403eb0000000000000000000000113404"
status = "sent"
type = "transactional"
}, (deliveryObject){
id = "0bf0702D03CB42D848CBB0B0AF023A87FA65"
start = 2018-12-29 23:00:00
messageId = "0bc403eb0000000000000000000000113403"
status = "sent"
type = "transactional"
}
]"""
</code></pre>
<p>然后我用regex列出了一个字典列表:</p>
^{pr2}$
<p>现在你有了一个字典列表。第一排看起来像这样</p>
<pre><code>list_of_dict = eval(a)
df = pd.DataFrame(list_of_dict[0])
print(df.head())
id start messageId status type
0 0bf003ee0000000000000000000002a11cb6 2019-01-02 09:30:00 68027b94b892396ed29581cde9ad07ff sent normal
</code></pre>
<p>从字典的列表中添加其余的字典</p>
<p>请随意改进我的正则表达式,我知道它看起来很糟糕。在</p>