Python学习笔记一:起始

in 编程 with 0 comment

学习之路漫漫无期,总归有个起始

Python之禅

在python中输入import this,就可以显示Python之禅,细细体味Python的道路:

The Zen of Python, by Tim Peters

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren't special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

There should be one-- and preferably only one --obvious way to do it.

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.

Although never is often better than right now.

If the implementation is hard to explain, it's a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!

Python之路

Linux开发环境

Linux或者Mac(推荐平台)下建议使用Pyenv虚拟环境,何为Pyenv?

官网地址:https://github.com/pyenv/pyenv

在项目开发中尤其重要,可以方便的控制Python版本和依赖库。

Windows开发环境

Windows下建议使用Visual env,也是虚拟环境的一种,类似Pyenv。

推荐IDE

不管在Linux还是Windows还是Mac系统下,开发Python总离不开IDE,这个还是要看个人还好,推荐:

Jupyter Notebook

学习过程中建议使用Jupyter,配合Ipython真的太方便了,能方便的执行代码,查看代码类型,计算代码时间等等。

Windows下的Jupyter目录默认是C盘下,带有很多目录,可以用下面方式修改工作目录:

jupyter notebook --generate-config
c.NotebookApp.notebook_dir = 'E:PythonJupyter'

一些有帮助的建议

  1. 可以在学习一段时间后,稍微有点基础再看些书籍,推荐书籍如下:

  2. 要习惯开始看帮助文档,虽然一开始有点难懂,看多了就好了。
  3. 对库有疑惑的可以在官方网站中找到并进去查看帮助。
  4. 能用Google就别用百度,原因就不说了。
  5. 能自己想办法写的就别搜,开局速度慢BUG多这是正常的,不这样才是开挂,要封号的~
  6. 在每学完一种方法后最好每天重复练习下,记忆有时候真的比不上身体熟悉度。
  7. 保持良好的代码风格、注释,尽量使用Python特色代码能让你开发更轻松更有效率,将它变成习惯。
Responses