作者:
RicohG8 (I G8 U)
2022-10-14 20:50:54做了一個查詢momo商品的小程式
正常keyword 沒有空格就能正常跑
但是有空格網址就會斷掉
我看momo自己搜尋是 空格會自動轉換變成%20
EX: 搜尋 The North Face
keyword=The%20North%20Face
我的程式範例:
keyword = 'The North Face'
url =
'https://m.momoshop.com.tw/search.momo?_advFirst=N&_advCp=N&curPage={}
&searchType=6&cateLevel=2&ent=k&searchKeyword={}
&_advThreeHours=N&_isFuzzy=0&_imgSH=fourCardType
&_advPriceS=250&_advPriceE='.format(page, keyword)
請問該怎麼讓他把空格轉成 %20呢?