笨办法学Python

最新书摘:
  • [已注销]
    2013-05-18
    1.逆向阅读,在每一行的上面加一行注解。 2.倒着朗读出来,找出自己的错误。 3.从现在开始,把你的错误记录下来,写在一张纸上。 4.在开始下一节习题时,阅读一遍你记录下来的错误,并且尽量避免在下个练习中再犯同样的错误。 5.记住,每个人都会犯错误。程序员和魔术师一样,他们希望大家认为他们从不犯错,不过这只是表象而已,他们每时每刻都在犯错。
  • wangv
    2012-11-20
    Explain why the 4.0 is used instead of just 4.
  • 爱乐的陈
    2012-03-18
    When you write comments, describe why you are doing what you are doing. The code already says how, but why you did things the way you did is more important.
  • 爱乐的陈
    2012-03-14
    A colon at the end of a line is how you tell Python you are going to create a new "block" of code, and then indenting 4 spaces tells Python what lines of code are in that block.
  • 爱乐的陈
    2012-03-12
    Functions do three things:1.They name pieces of code the way variables name strings and numbers.2.They take arguments the way your scripts take argv.3.Using #1 and #2 they let you make your own "mini scripts" or "tiny commands".You can create a function by using the word def in Python.
  • 爱乐的陈
    2012-03-12
    You should immediately notice that we import another handy command named exists. This returns True if a file exists, based on its name in a string as an argument. It returns False if not.Did you see that trick I did with cat? It only works on Linux or OSX, on Windows use type to do the same thing.
  • 爱乐的陈
    2012-03-09
    The argv is the "argument variable", a very standard name in programming, that you will find used in many other languages. This variable holds the arguments you pass to your Python script when you run it. In the exercises you will get to play with this more and see what happens.Line 3 "unpacks" argv so that, rather than holding all the arguments, it gets assigned to four variables you can work with: script, first, second, and third. This may look strange, but "unpack" is probably the best word to describe what it does. It just says, "Take whatever is in argv, unpack it, and assign it to all of these variables on the left in order."
  • 爱乐的陈
    2012-03-08
    From now on, when you make mistakes write down on a piece of paper what kind of mistake you made.When you go to the next exercise, look at the last mistakes you made and try not to make them in this new one.
  • 爱乐的陈
    2012-03-06
    Hit CTRL-D (^D) and get out of python.> mkdir mystuff> cd mystuff> dir
  • 九识澪
    2017-07-08
    我从事编程已经太长时间,长到对我来说编程已经是非常乏味的事情了。我写这本书的时候,已经懂得大约 20 种编程语言,而且可以在大约一天或者一个星期内学会一门编程语言(取决于这门语言有多古怪)。现在对我来说编程这件事情已经很无聊,已经谈不上什么兴趣了。当然这不是说编程本身是一件无聊的事情,也不是说你以后也一定会这样觉得,这只是我个人在当前的感觉而已。在这么久的旅程下来我的体会是:编程语言这东西并不重要,重要的是你用这些语言做的事情。事实上我一直知道这一点,不过以前我会周期性地被各种编程语言分神而忘记了这一点。现在我是永远不会忘记这一点了,你也不应该忘记这一点。你学到和用到的编程语言并不重要。不要被围绕某一种语言的宗教把你扯进去,这只会让你忘掉了语言的真正目的,也就是作为你的工具来实现有趣的事情。编程作为一项智力活动,是唯一一种能让你创建交互式艺术的艺术形式。你可以创建项目让别人使用,而且你可以间接地和使用者沟通。没有其他的艺术形式能做到如此程度的交互性。电影领着观众走向一个方向,绘画是不会动的。而代码却是双向互动的。编程作为一项职业只是一般般有趣而已。编程可能是一份好工作,但如果你想赚更多的钱而且过得更快乐,你其实开一间快餐分店就可以了。你最好的选择是将你的编程技术作为你其他职业的秘密武器。技术公司里边会编程的人多到一毛钱一打,根本得不到什么尊敬。而在生物学、医药学、政府部门、社会学、物理学、数学等行业领域从事编程的人就能得到足够的尊敬,而且你可以使用这项技能在这些领域做出令人惊异的成就。当然,所有的这些建议都是没啥意义的。如果你跟着这本书学习写软件而且觉得很喜欢这件事情的话,那你完全可以将其当作一门职业去追求。你应该继续深入拓展这个近五十年来极少有人探索过的奇异而美妙的智力工作领域。若能从中得到乐趣当然就更好了。最后我要说的是...