如何将帖子数据转换为可以在Python中使用的变量

发布于 2025-02-12 20:32:50 字数 289 浏览 0 评论 0原文

我一直在尝试找到一种从请求转换发布数据的方法 当我打印数据时,这是我得到的b'message = sdfa& arent = gfsdgd& btn3 =按下' 我已经尝试了使用不同的方法来替换它,但是我意识到这是不起作用的,我看到烧瓶做了这样的事情,但是ID必须使用它重写我的所有代码 我正在使用http.server,我想知道我是否可以像json一样格式化输出格式,所以我可以使用诸如value [“消息”]之类的东西,这会给我带来消息,

这是我第一次使用堆栈溢出我很抱歉,如果我没有意义或看起来很愚蠢

I've been trying to find a way to convert POST data from a request
when i print the data this is what i get b'message=sdfa&arent=gfsdgd&btn3=pressed'
I've tried different ways to get it ive used replace but i realized that wasnt gonna work i saw that flask does something like this but id have to rewrite all my code using it
i am using http.server and i was wondering if i could have the output formatted like json so were i could use something like value["message"] and it would give me what is inside the message

this is my first time using stack overflow so im sorry if i dont make sense or look stupid

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月朦胧 2025-02-19 20:32:50

问题是通过评论回答的,

有一个库将链接格式化为json文件,

库称为urllib
非常感谢Metatoaster

question was answered by a comment

There is a library that formats a link into practically a json file

the library is called urllib
big thanks to metatoaster

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文