初学python,记录的有点乱。先开始吧。

来源:互联网 发布:淘宝top排行榜关键词 编辑:程序博客网 时间:2024/05/21 07:49

1、python中os.path.dirname(file)的使用
(1).当”print os.path.dirname(file)”所在脚本是以完整路径被运行的, 那么将输出该脚本所在的完整路径,比如:
python /home/magic/demo.py
那么将输出 /home/magic

(2).当”print os.path.dirname(file)”所在脚本是以相对路径被运行的, 那么将输出空目录,比如:
python demo.py
那么将输出空字符串
2、from … import …
3、

0 0
原创粉丝点击