人生苦短,我用Python
废话不多说,全是
!!干货!!
我毕生所学,全都在这了,您自己看着办吧
Python2 or 3 (Get started to >3!)
Character encoding
If you need Chinese character:
Python 2.7:
http://stackoverflow.com/questions/2688020/how-to-print-chinese-word-in-my-code-using-python, you need add
Python 3.5: (in Pycharm: Project: xxx -> Project Interpreter, choose Project Interpreter you installed in your computer)
No need, it can support Chinese
Windows install Python
Python 2.7: C:\Pthon27
Python 3.5: C:\Program Files\Python35->python.exe (add it to environment variable for terminal-if there is python2, you can rename it as python3.exe then add it in case of name conflict )
Run hello.py
When run (bash) without indicator
You might encounter: syntax error near unexpected token.
You should check:
ll hello.py -> checkexecutable right: 'x'
tell linux you are using python to execute this file, or it will treat .py as shell script:
Add as the first line of the file. Note you should use /usr/bin/envpython so that path will not bother you. ( like Shell script: bin/bash )
Indent
DO NOT USE [tab], if in Linux vim, use [tab]--it will be a [tab] NOT SAME AS INDENT
Break a long line
http://stackoverflow.com/questions/53162/how-can-i-do-a-line-break-line-continuation-in-python
http://stackoverflow.com/questions/4172448/is-it-possible-to-break-a-long-line-to-multiple-lines-in-python?noredirect=1&lq=1
感谢您的关注 !至此 --您在Python之路的成长将是我们关心的 !我们接受任何意见和建议
本文图片均来源于网络,如有侵权,请联系删除。
领取专属 10元无门槛券
私享最新 技术干货