Heim >Backend-Entwicklung >Python-Tutorial >Python 有哪些入门学习方法和值得推荐的经典教材?
刚刚入门python 希望大家帮助
入门三选一
Introducing Python: Modern Computing in Simple Packages
推荐比较轻松的学习方法,书籍推荐《笨办法学Python(第三版)》,视频推荐fishc论坛的《小甲鱼Python入门教程》,虽然讲的不深,但是很能学进去。唯一的不好的地方是《笨办法学Python》这书的作者是Python2的粉。 just do it.Mark Lutz is the most experienced Python trainer in the world. He has been teaching Python classes for 17 years, and has taught some 260 sessions for 4,000 students in the US and abroad. His classes use instructional techniques which mirror those in his successful books, augmented by the immediate feedback and focus-enabling context that only a live class can provide. From diverse corners of the software field, clients both large and small have chosen Mark Lutz's classes for their Python training needs.另外要说一下本书中的示例程序,除了变量名不那么 Pythonic 以及注释不太规范之外,每一个示例程序都很值得模仿,篇幅有限,举个小例子:
<code class="language-python"><span class="k">class</span> <span class="nc">Person</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">getName</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">valid</span><span class="p">():</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">'cannot fetch name'</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">transform</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">setName</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">valid</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">'cannot change name'</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
</code>