Python学习, 学习笔记

Python 学习——第一个小程序

    I’m learning Operating System these days, and I met tasks should be solved by python, and I write this note to  record the things I have learnt so that I can understand it better and may be useful for other learners. I use RUNOOB(http://www.runoob.com/python) to learn. I may quote some places of this website and I express my thanks here.

  1. 简介

    • 英文意思是“巨蟒”,我们的Python可是一条很可爱的小蟒蛇!名字的来源是因为它的创造者——Guido van Rossum在1989年的圣诞,在阿姆斯特丹闲着没事儿,就变个脚本解释型语言来继承Guido非常喜欢的ABC编程语言。Python的设计理念是“优雅”,“明确”,“简单”。时间越长越是凸显着个理念的正确性,“less is more”的观念被越来越多的人们所认可,我想这也是Python越来越火爆的原因之一。在代码中加入“import this”就可以看到Python的设计格言。(I also have a friend called Guido, and he lives in Amsterdam, you comment below or contact me if you want his photo and if he permits, BTW, he has really charming eyes. ;))
    • 捕获
  2. 特点

    • 解释形语言:不需要编译,类似PHP
    • 交互式语言:互动执行程序
    • 面向对象:像C++一样可以封装
    • 初学者语言:支持广泛的程序开发
  3. 安装环境

    • 下载Python,for windows:(http://www.runoob.com/python)
    • 安装:根据命令提示符
    • 环境变量配置:其实windows安装的时候就有提示啦!
    • 检查是否安装完毕:
    • Image
  4. 运行

    • 我用创建一个文件叫hello.py,用普通编辑器打开,编辑:
    • Image (2)
    • 用cmd打开命令框 
    • Image (3)
    • 运行成功啦!
  5. 中文编码

    • 这个python喜欢英文,你要输出中文得先打声招呼:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

(第一h行是告诉系统:我开始执行Python程序啦!第二行:中文编码,打招呼

试着运行一下:

Image (4)

Image (5)

  

Be the First to comment.

Leave a Comment

您的电子邮箱地址不会被公开。

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理