python 第一课 helloworld

#!/usr/bin/env python
#-*-coding:utf-8-*-
#以上是配置编写环境的开始
#第一行env表示运行当前环境变量内的python版本(2.x or 3.x)
#第二行表示编码格式是utf-8支持中文注释或者字符串中文输出(3.x以上默认支持) print'hello world' #第一个简易代码打印hello world
print('hello one') #在python3.x以上打印语句要加()表示 和java等一些语言类似
print'hello\ntwo' #在打印中加入\n代表换行,和你在文本txt输入时Enter回车一下类似。
print('hello\tthree') #在打印中\t表示分割字符串,类似中间加tab或空格间距。
print'\"' #打印特殊字符反引号"时要加入反斜杠\来告诉编译器识别
print"\\" #同上同理
print"""
What's your name
My name is Cookie
Tanks Watching
"""

本文主要讲 python2和python使用helloworld的不同,及分隔符简单介绍。

结果输出如下:

python 第一课 helloworld

上一篇:Android源码编译make的错误处理


下一篇:源码编译运行android emulator