亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

post方法返回都是none

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

import web

? ? ? ??

urls = (

'/index','index',

'/blog/\d','blog',

? ? '/(.*)', 'hello'

)

app = web.application(urls, globals())


class index:

def GET(self):

query=web.input()

return query

class blog:

def POST(self):

data=web.input()

return data


class hello:? ? ? ??

? ? def GET(self, name):

? ? ? ? return open(r'new2.html').read()


if __name__ == "__main__":

? ? app.run()

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

<!DOCTYPE HTML>

<html><head meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>小型demo</title>

</head>

<body>

<h1>POST</h1>

<form action="/blog/123" method="POST">

<input type="text" name="id" value=""/>

<input type="password" name="password" value=""/>

<input type="submit" value="submit"/>

</form>

</body>

</html>

??

上面分別是html和python的源碼,網頁返回的都是none

正在回答

1 回答

那你在地址欄輸入的什么呢?

如果你輸入的是可以匹配上這個的'/blog/\d','blog',那么頁面可能會返回none;

如果想找到那個表單界面,只需要匹配?'/(.*)', 'hello',然后輸入用戶名密碼,提交后地址欄就會變成http://127.0.0.1:8080/blog/123,但是由于你上面寫的是\d,但是\d只能匹配上一個數字。。你可以試試改成\d+,或者吧html頁面的<form action="/blog/123" method="POST">改成<form action="/blog/1" method="POST">

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
python-web.py開發入門
  • 參與學習       58634    人
  • 解答問題       118    個

web.py開發入門入門教程,講解一個你最快能學會的web開發的框架

進入課程

post方法返回都是none

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號