简明python教程

linux查询python版本:python -V

linux进入python:python

退出python:CTRL+D

 

使用源文件:helloworld.py

运行这个程序:python helloworld.py

 

目录添加到PATH变量中:PATH=$PATH:/home/swaroop/mydir完成。其中“/home/swaroop/mydir ”是我想要添加到PATH变量中的目录。

 

python中字符串使用:

(1)使用单引号(‘)

‘Quote me on this

(2)使用双引号(“)

双引号中的字符串与单引号中的字符串的使用是完全相同的。

" What's your name?"

(3)使用三引号(”’或者“‘”’)

利用三引号,可以指示一个多行的字符串。你可以在三引号中自由的使用单引号和双引号。

''' This is a multi-line string.This is the first line.This is the second line."waht's your name?,"I asked.He said "Bond,James Bond. " '''

(4)转义符

在字符串中输出’ " \,使用\' \" \\

注意:“This is the first sentence.\

This is the second sentence.”=====>等价于“This is the first sentence.This is the second sentence.”

posted on 2017-02-03 18:06  白宫飘红旗  阅读(468)  评论(0编辑  收藏  举报