rules

rules = """
if 冷血 and 没有腿 then 蛇
if 冷血 and 有腿 then 蜥蜴
if 非冷血 and 有羽毛 and 不会飞 then 鸡
if 非冷血 and 没有羽毛 then 猫
"""

rules = rules[1:-1].split('\n')
Q = []
P = []
for line in rules:
line = line.replace('if', '').strip()
line = line.split('then')
Q.append(line[1])
temp = line[0].split('and')
P.append(line[1])

print(P)
print(Q)
posted @ 2024-06-05 16:01  freedragon  阅读(7)  评论(0编辑  收藏  举报