python基础篇_python基础篇之介绍

python基础篇是以Google for Education上面的

Google’s Python Class课程为主.这是一门非常适合初学者的课程.

英文介绍

Welcome to Google’s Python Class – this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a “variable” or “if statement” is. Beyond that, you do not need to be an expert programmer to use this material.

To get started, the Python sections are linked at the left – Python Set Up to get Python installed on your machine, Python Introduction for an introduction to the language, and then Python Strings starts the coding material, leading to the first exercise. The end of each written section includes a link to the code exercise for that section’s material. The lecture videos parallel the written materials, introducing Python, then strings, then first exercises, and so on. At Google, all this material makes up an intensive 2-day class, so the videos are organized as the day-1 and day-2 sections.

This material was created by Nick Parlante working in the engEDU group at Google. Special thanks for the help from my Google colleagues John Cox, Steve Glassman, Piotr Kaminksi, and Antoine Picard. And finally thanks to Google and my director Maggie Johnson for the enlightened generosity to put these materials out on the internet for free under the under the Creative Commons Attribution 2.5 license – share and enjoy!

课程结构

该课程主要包含以下三大模块,当然最重要的莫过于课程后面的练习了.文档

视频

练习

![课程结构]({{ site.baseurl }}/assets/images/python_struct.png)

简单python样例

就像刚刚学习c语言接触第一个"Hello world!“程序一样,下面就是一个简单的python版的"Hello world!“程序.代码示例

1#!/usr/bin/python

2

3# 导入所用模块 -- sys 是常用的模块

4import sys

5

6# 代码写在main()里面

7def main():

8 print 'Hello World!'

9 # 命令行的参数在 sys.argv[1], sys.argv[2] ...

10 # sys.argv[0] 表示脚本名称

11

12# 调用main()函数来启动程序的样板

13if __name__ == '__main__':

14 main()> **注意:**

> 代码第一行`#!/usr/bin/python`是当使用./scrpt.py执行该段程序时指定解释器的路径. 显然这里是linux的路径,windows可以换成`#!C:\Python2.7`

>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值