Python基础练习(ex1.py)

时间:2015-05-19 15:03:44   收藏:0   阅读:186
新建ex1.py
print "Hello World!"
print "Hello Yang"
print "I like typing this."
print "This is fun."
print ‘Yay! Printing.‘
print "I‘d much rather you ‘not‘."
print ‘I "said" do not touch this.‘

执行命令:python ex1.py 结果如下:

[root@yang mystuff]# python ex1.py 

hello world!

hello Again

I like typing this.

Yay! Printing.

I‘d much rather you ‘not‘.

I "said" do not touch this.

如果有如下类似错误信息:

File "ex/ex1.py",line 3

                       ^

print "I like typing this.

SyntaxError:EOL while scanning string literal 

SyntaxError:语法错误,这样一般来说为编码错误,即可以在脚本最上面加入

#-*-coding:utf-8-*-  就可以避免上述错误。

本文出自 “MGnuLinux” 博客,请务必保留此出处http://inspriion.blog.51cto.com/3283848/1652680

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!