码迷,mamicode.com
首页 > 编程语言 > 详细

python3.x入门教程

时间:2015-12-28 12:18:54      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:

Python的3.0版本,常被称为Python 3000,或简称Py3k。相对于Python的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0在设计的时候没有考虑向下兼容。

查看python的版本:

bogon:~ zhangkai$ python3 -V
Python 3.5.1

进入到python的交互模式中也可以查看版本,顺便写第一个程序“Hello,World!”

1 bogon:~ zhangkai$ python3
2 Python 3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 
3 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
4 Type "help", "copyright", "credits" or "license" for more information.
5 >>> print("Hello,World!")
6 Hello,World!
7 >>> exit()

也可以保存到一个文件里运行,python的文件是以".py"结尾的文件方式保存的。

1 bogon:~ zhangkai$ vim hello.py
2 #!/usr/bin/env python
3 print("Hello,World!")
4 bogon:~ zhangkai$ python3 hello.py 
5 Hello,World!

第一个python程序就这样搞定了~

 

python3.x入门教程

标签:

原文地址:http://www.cnblogs.com/allan-king/p/5081942.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!