gpt4 book ai didi

python :- passing HTML form input to python code and execute it

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

<分区>

您好,我想从 html 表单获取输入并将其传递给我的 python 脚本并使其执行,然后我想在不使用任何框架的情况下在浏览器中打印我的结果。下面是我的 python 代码:

import re

hap=['amused','beaming','blissful','blithe','cheerful','cheery','delighted']

sad=['upset','out','sorry','not in mood','down']

sad_count=0

happy_count=0

str1=raw_input("Enter Message...\n")

happy_count=len(filter(lambda x:x in str1,hap))

sad_count=len(filter(lambda x:x in str1,sad))

if(happy_count>sad_count):

print("Hey buddy...your mood is HAPPY :-)")

elif(sad_count>happy_count):

print("Ouch! Your Mood is Sad :-(")

elif(happy_count==sad_count):

if(happy_count>0 and sad_count>0):

print("oops! You are in CONFUSED mood :o")

else:
print("Sorry,No mood found :>")

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