python trick packages
-
Pretty dir()
-
可以设置 ipython auto import
add a startup file(.py) to ~/.ipython/profile_default/startup/
Use JSON files as if they are python modules
导入json 文件作为一个包使用
-
tester.json
{ "hello": "world", "this": { "can": { "be": "nested" } } }
Now import jsonsempai and your json file!
>>> from jsonsempai import magic >>> import tester >>> tester <module 'tester' from 'tester.json'> >>> tester.hello u'world' >>> tester.this.can.be u'nested' >>>