[英]How to run a url from inside a python script to command line?
我有這個命令行文本,我想在我的 python 腳本中運行到命令行。 關於如何做到這一點的任何建議?
explorer "ms-drive-to:?
destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake"
當然,你可以做類似這篇文章中描述的事情:
似乎您應該使用subprocess
:
如果你想在 python shell 中有效地運行它,像這樣:# it will open windows map
>>> !explorer "ms-drive-to:?
destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake"
如果你想在代碼中運行,就像其他方法一樣。所有答案都是正確的。
import os
command_str = 'explorer "ms-drive-to:? destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake"'
os.system(command_str)
# it will open windows map, and driving directions to Green Lake from your current location.
windows uwp 信息: https ://docs.microsoft.com/en-us/windows/uwp/launch-resume/launch-maps-app
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.