我正在通过Sub A2()
[I1] = Worksheetfunction.Average(Range("C1", "G1"))
End Sub ' ^
解析长网址
格式解析为:“ url1”,“ url2”,“ url3”
并尝试将输出值转换为列表,但得到类似
的结果url1,url2,url3
解析网址:
sys.argv
输出为无效列表
"https://www.amazon.com/sp?_encoding=UTF8&asin=B00ZGCKLE2&isAmazonFulfilled=0&isCBA=&marketplaceID=ATVPDKIKX0DER&orderID=&seller=A6T9C2PUZSUPW&tab=&vasStoreID=","https://www.amazon.com/sp?_encoding=UTF8&asin=B00ZGCKLE2&isAmazonFulfilled=0&isCBA=&marketplaceID=ATVPDKIKX0DER&orderID=&seller=A1916U364TPZBZ&tab=&vasStoreID="
['https://www.amazon.com/sp?_encoding=UTF8&asin=B00ZGCKLE2&isAmazonFulfilled=0&isCBA=&marketplaceID=ATVPDKIKX0DER&orderID=&seller=A6T9C2PUZSUPW&tab=&vasStoreID=,https://www.amazon.com/sp?_encoding=UTF8&asin=B00ZGCKLE2&isAmazonFulfilled=0&isCBA=&marketplaceID=ATVPDKIKX0DER&orderID=&seller=A1916U364TPZBZ&tab=&vasStoreID=']
解析命令
import sys
test = sys.argv[1]
print([test])
答案 0 :(得分:-1)
import sys
test = sys.argv[1:] # you want all arguments so slice to the end,
# test is then already a list
print(test) # so no need to pack `test` into a list here, because it IS a list
然后称呼它
python test.py "https://www.amazon.com/sp?_encoding=UTF8&asin=B00ZGCKLE2&isAmazonFulfilled=0&isCBA=&marketplaceID=ATVPDKIKX0DER&orderID=&seller=A6T9C2PUZSUPW&tab=&vasStoreID=" "https://www.amazon.com/sp?_encoding=UTF8&asin=B00ZGCKLE2&isAmazonFulfilled=0&isCBA=&marketplaceID=ATVPDKIKX0DER&orderID=&seller=A1916U364TPZBZ&tab=&vasStoreID="