开发者社区> 问答> 正文

如何从python脚本内部运行url到命令行?

我有此命令行文本,我想在我的python脚本中运行到命令行。有关如何执行此操作的任何建议?

explorer "ms-drive-to:? 



destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake"

问题来源:stackoverflow

展开
收起
is大龙 2020-03-23 18:52:29 460 0
1 条回答
写回答
取消 提交回答
  • 如果您想在python shell中有效运行此代码,例如:#它将打开Windows映射

    >>> !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/zh-cn/windows/uwp/launch- resume / launch-maps-app

    回答来源:stackoverflow

    2020-03-23 18:52:36
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载