python的模拟switch方案

def case1():                            # 第一种情况执行的函数
    print('This is the case1')

def case2():                            # 第二种情况执行的函数
    print('This is the case2')

def case3():                            # 第三种情况执行的函数
    print('This is the case3')

def default():                          # 默认情况下执行的函数
    print('No such case')

switch = {'case1': case1,                # 注意此处不要加括号
          'case2': case2,                # 注意此处不要加括号
          'case3': case3,                # 注意此处不要加括号
          }

choice = 'case1'                         # 获取选择
switch.get(choice, default)()            # 执行对应的函数,如果没有就执行默认的函数

python安装cx_Oracle

linux上安装cx_Oracle方法:

1、首先复制instantclinet并解压到/usr/lib/instantclient_12_2

apt-get install libaio1
sudo sh -c "echo /usr/lib/instantclient_12_2/ > /etc/ld.so.conf.d/oracle-instantclient.conf"
ldconfig

在CentOS中安装 yum install libaio

动态链接库连接完毕之后,增加一些环境变量

export ORACLE_HOME=/usr/lib/instantclient_12_2
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

可以加入到 .bashrc 中,修改系统全局设定;

source ~/.bashrc 来使它立即生效

pip中科大源

实际测试了一下,南邮的源还是差一些,这个放在C:/users/XXX/pip/pip.ini

[global]
index-url =  https://mirrors.ustc.edu.cn/pypi/web/simple 

或者临时使用

pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple package