python学习笔记01--环境变量

1、比如linux下将/tmp路径加入环境变量

[root@localhost ~]# cat .bashrc 
export PYTHONPATH=$PYTHONPATH:/tmp     增加环境变量

2、查看刚增加的环境变量:

>>> import sys,pprint

>>> pprint.pprint(sys.path)
['',
 '/root',
 '/tmp',
 '/usr/lib64/python27.zip',
 '/usr/lib64/python2.7',


3、windows下只需编辑环境变量参数增加PYTHONPATH   

4、模块自带函数

>>> import copy

>>> dir(copy)               dir可以模块所有的函数、变量等

['Error', 'PyStringMap', '_EmptyClass', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_copy_dispatch', '_copy_immutable', '_copy_inst', '_copy_with_constructor', '_copy_with_copy_method', '_deepcopy_atomic', '_deepcopy_dict', '_deepcopy_dispatch', '_deepcopy_inst', '_deepcopy_list', '_deepcopy_method', 


在使用from copy import * 时可以使用__all__里的函数

>> copy.__all__          

['Error', 'copy', 'deepcopy']

__file__可以查看模块路径:

>>> print copy.__file__                  
/usr/lib64/python2.7/copy.pyc


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值