第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

pyFlask 將我的輸入放在我的 url 瀏覽器中

pyFlask 將我的輸入放在我的 url 瀏覽器中

紫衣仙女 2022-06-02 16:24:46
簡而言之,python Flask 是我使用的網絡托管工作臺,我正在嘗試創(chuàng)建一個不會出現在您的歷史記錄中的輸入表單。這是我的表單html:<form name="ViewWindow" action="/home/ViewWindow/ViewWindowResult/">  <input name="url" type="url" required="required" placeholder="URL Here">  <input type="submit" value="Go"></form>這是使用輸入url的 python 代碼:@web_site.route('/home/ViewWindow/ViewWindowResult/', methods=('GET', 'POST'))def ViewWindowResult():  urlboi = request.values.get('url')  response = urllibrequest.urlopen(url) # import urllib.request as urllibrequest  htmlBytes = response.read()  htmlstr = htmlBytes.decode("utf8")  return html("ViewWindowResult.html", value=htmlstr)我的目標是到達這里;/home/ViewWindow/ViewWindow/ViewWindowResult/,但是當我輸入“ https://www.w3schools.com/tags/”時, 我最終到達了這里;/home/ViewWindow/ViewWindowResult/?url=https%3A%2F%2Fwww.w3schools.com%2Ftags%2F為什么 Flask 將我的輸入放在 url 字符串中?我不打算在任何地方這樣做。編輯:您可以通過訪問https://sm--supermechm500.repl.co/home/ViewWindow/來查看
查看完整描述

2 回答

?
明月笑刀無情

TA貢獻1828條經驗 獲得超4個贊

嘗試像這樣指定表單方法:


<form name="ViewWindow" action="/home/ViewWindow/ViewWindowResult/" method="post">

  <input name="url" type="url" required="required" placeholder="URL Here">

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

</form>


查看完整回答
反對 回復 2022-06-02
?
慕斯王

TA貢獻1864條經驗 獲得超2個贊

使用 post 方法,如


    <form name="ViewWindow" action="/home/ViewWindow/ViewWindowResult/" method="post">

  <input name="url" type="url" required="required" placeholder="URL Here">

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

</form

然后你的python代碼是


   @web_site.route('/home/ViewWindow/ViewWindowResult/', methods=('GET', 'POST'))

def ViewWindowResult():

  input=request.form['url']

#write your code here

return(input)

它對我有用,它將打印您輸入的相同網址


查看完整回答
反對 回復 2022-06-02
  • 2 回答
  • 0 關注
  • 173 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

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

公眾號

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