我的文本格式数据如下所示
[{"title": "System and Method for Maskless Direct Write Lithography", "lang": "en", "year": 2015, "references": ["354c172f-d877-4e60-a7eb-c1b1cf03ce4d", "76cf1064-b2b2-4245-940b-4e25dab9d41d"], "abstract": "A system and method for maskless direct write lithography are disclosed. The method includes receiving a plurality of pixels that represent an integrated circuit (IC) layout; identifying a first subset of the pixels that are suitable for a first compression method; and identifying a second subset of the pixels that are suitable for a second compression method. The method further includes compressing the first and second subset using the first and second compression method respectively, resulting in compressed data. The method further includes delivering the compressed data to a maskless direct writer for manufacturing a substrate. In embodiments, the first compression method uses a run-length encoding and the second compression method uses a dictionary-based encoding. Due to the hybrid compression method, the compressed data can be decompressed with a data rate expansion ratio sufficient for high-volume IC manufacturing.", "url": ["http://www.freepatentsonline.com/y2016/0211117.html", "http://www.google.com/patents/US20160211117", "https://www.google.de/patents/US20160211117"], "id": "0000002e-c2f2-4e25-9341-60d39130ac7a", "fos": ["Electronic engineering", "Computer hardware", "Engineering", "Engineering drawing"]}]我想做这样的
title lang year id
System and Method for eng 2015 0000002e-c2f2-4e25-9341-60d39130ac7a
Maskless Direct
Write Lithography 发布于 2018-12-21 02:11:38
将JSON数据作为字符串保存在变量data中。
data = """
[{"title": "System and Method for Maskless Direct Write Lithography", "lang": "en", "year": 2015, "references": ["354c172f-d877-4e60-a7eb-c1b1cf03ce4d", "76cf1064-b2b2-4245-940b-4e25dab9d41d"], "abstract": "A system and method for maskless direct write lithography are disclosed. The method includes receiving a plurality of pixels that represent an integrated circuit (IC) layout; identifying a first subset of the pixels that are suitable for a first compression method; and identifying a second subset of the pixels that are suitable for a second compression method. The method further includes compressing the first and second subset using the first and second compression method respectively, resulting in compressed data. The method further includes delivering the compressed data to a maskless direct writer for manufacturing a substrate. In embodiments, the first compression method uses a run-length encoding and the second compression method uses a dictionary-based encoding. Due to the hybrid compression method, the compressed data can be decompressed with a data rate expansion ratio sufficient for high-volume IC manufacturing.", "url": ["http://www.freepatentsonline.com/y2016/0211117.html", "http://www.google.com/patents/US20160211117", "https://www.google.de/patents/US20160211117"], "id": "0000002e-c2f2-4e25-9341-60d39130ac7a", "fos": ["Electronic engineering", "Computer hardware", "Engineering", "Engineering drawing"]}]
"""
df = pd.read_json(data, orient='records')
df[['title', 'lang', 'year']]
# Output:
# title lang year
# 0 System and Method for Maskless Direct Write Lithography en 2015如果数据在文件中,则可以从该文件中读取data
with open('file.txt') as f:
data = f.read()https://stackoverflow.com/questions/53873315
复制相似问题