0
我想獲得一個有效載荷值「productid」+1。但是當我使用productid + 1時,productid變量不會改變?爲什麼我的變量放在有效載荷中時不會改變?
當我運行的產品ID保持爲「7367」時,它應當已經更改爲「7368」
productid=7367
headers = {
"Host": "www..co.uk",
"Connection": "keep-alive",
"Content-Length": "121",
"Cache-Control": "max-age=0",
"Origin": "http://www..co.uk",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Chrome/57.0.2987.133 Safari/537.36",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.8",
}
payload = {
"attributes":"",
"product_quantity":"1",
"submit":"",
"product_id":productid+1,
"show_image_":"0",
}
print ("ProductID:"), productid
謝謝!很有幫助! – Larsson
您能否詳細說明我可以如何添加更多數字,例如+10 – Larsson
我不知道我關注。如果這就是你的意思,你可以用'productid + = 10'來增加10。 – davidejones