python 备忘与总结

来源:互联网 发布:免费轻小说软件 编辑:程序博客网 时间:2024/04/29 19:27

参考

  • zeef
  • pickle save load
  • (save and load .mat) (save and load 2)

科学开发环境

  • 推荐winPython,由于在windows 下配置完整的python科学环境比较麻烦,参见intstallation of theano on windows

个人感觉最好的IDE

  • Ninja (参考zeef中python IDE第一名)
  • 特点:symbol list(符号列表)+实时排错+分栏+缩进显示+折叠
    这里写图片描述

常用函数和模块

  • utf-8文件读写: codecs
  • 像Matlab一样查看当前变量: dir()
  • 更改当前路径: os.chdir()
  • 查看当前路径: print os.getcwd()
  • 使用系统程序: os.system(‘ls’)
  • 使用shell: sh.ls()
  • print 格式化输出
  • ipython终端中执行文件:%run xxx.py
  • 重新加载修改后的模块:reload xxx
  • 迭代器与生成器 yield
  • path
print ("%d hello "%(100))+"#"*10
from path import pathd = path('/home/guido/bin')for f in d.files('*.py'):  f.chmod(0755)
import json>>> with open('basic-pretty.json', mode='w', encoding='utf-8') as f:...     json.dump(basic_entry, f, indent=2)>>> with open('entry.json', 'r', encoding='utf-8') as f:...     entry = json.load(f)
0 0
原创粉丝点击