gpt4 book ai didi

python - 将 pretty-print 表格解析为 Python 对象

转载 作者:太空宇宙 更新时间:2023-11-04 10:43:41 24 4
gpt4 key购买 nike

<分区>

假设有一个名为 likes_and_dislikes 的字符串,在视觉上被格式化为如下所示的表格。

我如何解析字符串并返回包含喜欢和不喜欢的元组列表。还必须从元组列表中删除顶部标题(喜欢,不喜欢)。

likes_and_dislikes="""

+------------------------------------+-----------------------------------+
| likes | dislikes |
+------------------------------------+-----------------------------------+
| Meritocracy | Favoritism, ass-kissing, politics |
+------------------------------------+-----------------------------------+
| Healthy debates and collaboration | Ego-driven rhetoric, drama and FUD|
| | to get one's way |
+------------------------------------+-----------------------------------+
| Autonomy given by confident leaders| Micro-management by insecure |
| capable of attracting top-tier | managers compensating for a weak, |
| talent | immature team |
+------------------------------------+-----------------------------------+ """

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com