在我曾經運行的終端中:
wget https://chromedriver.storage.googleapis.com/101.0.4951.41/chromedriver_linux64.zip
假設我有一個名為test.py輸出版本號的 python 腳本,我如何在上面的 url 中插入該版本來替換101.0.4951.41
我的嘗試是這樣寫:
wget https://chromedriver.storage.googleapis.com/ 'python3 test.py' /chromedriver_linux64.zip
我更喜歡 1 like 解決方案。
uj5u.com熱心網友回復:
您可以按照以下模式將 test.py 的輸出重定向到您的 url:
echo 101.0.4951.41 | (read var; wget https://chromedriver.storage.googleapis.com/$var/chromedriver_linux64.zip)
輸出:
*file download logs*
只需替換echo 101.0.4951.41為python3 test.py.
uj5u.com熱心網友回復:
您實際上可以從test.py自身運行命令:
import os
version = "101.0.4951.41"
os.system(f"wget https://chromedriver.storage.googleapis.com/{version}/chromedriver_linux64.zip")
然后像這樣運行它:python test.py
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/472124.html
