20141123

今天用python写了个快速启动的小工具。

只要对应好,命令和程序的路径,就可。

import json
from subprocess import Popen

while True:
    program = input("请输入你常用的程序:")
    if program == "quit":
        print("good bye~~~")
        break
    json_file = open("cmdjson.json","r", encoding="utf-8")
    cmd_dict = json.load(json_file)
    for k, v in cmd_dict.items():
        if program == k:
            Popen(v)
            break
    else:
        print("找不到该程序")
{
    "mp3": "F:/我的软件/娱乐工具/AIRPLAY.exe",
    "qq":"D:/Program Files (x86)/Tencent/QQ/QQProtect/Bin/QQProtect.exe",
    "dvd":"D:/Program Files (x86)/SPlayer/splayer.exe",
    "uc":"D:/Program Files/uc/UCBrowser/Application/UCBrowser.exe",
    "ps":"D:/Program Files/ps6/Adobe Photoshop CS6 (64 Bit)/Photoshop.exe",
    "chrome":"C:/Users/samwu/AppData/Local/Google/Chrome/Application/chrome.exe",
    "st3":"D:/Program Files (x86)/Sublime Text3/sublime_text.exe"
}

坑是有的,就是python对json文件的解析,如果json文件里包括"\"这个斜杠,表示转义,就会解析错误,你要"\\"才可以正确解析。或者全部处理成反斜杠。

时间: 2024-08-01 22:45:48

20141123的相关文章

【2014-11-23】Heterogeneous Parallel Programming – Section 1

Latency devices(CPU cores) Throughput devices(GPU cores) Use the best match for the job (heterogeneity in mobile SOC CPU: Latency Oriented Design Powerful ALU Reduced operation latency Large caches convert long latency memory accesses to short latenc

【2014-11-23】《The Hardware/Software Interface》– Section 11

Data in Java Java has pointers – they are called 'referenes' Null is typically represented as 0 Characters and strings Two-byte Unicode instead of ASCII Represents most of the world's alphabets String not bounded by a '\0'(null character) Bounded by

【2014-11-23】《The Hardware/Software Interface》– Section 10

The malloc package void* malloc(size_t size) void free (void *p) other functions calloc: Version of malloc that initializes allocated block to zero realloc: Changes the size of a previously allocated block abrk: Used internally by allocators to grow

【2014-11-23】《The Hardware/Software Interface》– Section 7

Cache Definition: computer memory with short access time used for the storage of frequently or recently used instructions or data(i-cachhe and d-cache). more generally, used to optimize data transfers between system elements with different characteri

【2014-11-23】《The Hardware/Software Interface》– Section 8 (continue)

Exceptions: An exception is transfer of control to the operating system in response to some event. exception processing by exception handler Process(进程) Process abstraction provides an interface between the program and the underlying CPU + Memory. De

mysql 基本操作

mysqld --install             安装mysql net start mysql            开启mysql mysql -uroot                登陆本机mysql net stop mysql            停止mysql mysql>\q                     退出mysql mysql\exit                    退出mysql mysql\quit                    退

C中的时间函数的用法

C中的时间函数的用法    这个类展示了C语言中的时间函数的常用的用法. 源代码: #include <ctime>#include <iostream> using namespace std; class MyTime{public:    MyTime() { mPTime = 0; mStLocalTime = 0; mStGMTTime = 0; }    ~MyTime() {}; //time_t time(time_t * timer) 返回自1970年1月1日00

记事本APP之Alpha报告

项目名称 记事本APP 项目版本 Alpha版本 负责人 北京航空航天大学计算机学院 Echo软件团队 联系方式 http://www.cnblogs.com/echo-buaa/ 要求发布日期 2014-11-23  一 .版本功能 1.基础记事功能 作为一款基于笔记本开发的记事软件,准确有效的进行事件的记录是各项功能开展的基础,也是所有笔记本软件的开发目的与需求所在,我们的APP在总结了各种笔记本软件的性能之后,以简约便捷.可用性强为开发目的,开发设计笔记本主体界面,实现记事功能. 具体的设

CentOS 7下的软件安装方法及策略

一些废话 2010年开始正式接触Linux,入门发行版是Ubuntu 10.10,后来过渡到Ubunu 11.04,这其中也尝试了很多其他主流的发行版.进入实验室之后,开始用CentOS 5,然后是CentOS 6,现在进化到CentOS 7. 使用了四年的Linux,前三年都是在瞎折腾,浪费了不少时间,也得到了不少经验与教训.现在可能是真的老了,已经不愿意折腾了,只希望配置好一个系统之后,就一直使用下去. 为什么要写/读这一篇 使用Linux尤其是CentOS会遇到一些坑,或是一些有洁癖的人不