[英]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.