'''

python保留字即关键字,我们不能把它们用作任何标识符名称。Python 的标准库提供了一个 keyword 模块,可以输出当前版本的所有关键字:

'''
>>> import keyword
>>> keyword.kwlist
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
#单行注释以 # 开头
#the 1th comment
print("hello, python!")
#多行注释可以用多个 # 号,还有 ''' 和 """
'''
the 2th comment
the 3th comment
'''
"""
the 4th comment
the 5th comment
"""
'''

python最具特色的就是使用缩进来表示代码块,不需要使用大括号({})。

缩进的空格数是可变的,但是同一个代码块的语句必须包含相同的缩进空格数

'''
if True:
print("True")
print("True end")
else:
print("False")
print("False end")
#缩进不一致,执行后会出现类似以下错误:
'''this will cause indentation error:IndentationError: unindent does not match any outer indentation level'''
#通常是一行写完一条语句,但如果语句很长,我们可以使用反斜杠(\)来实现多行语句
item1 = 1
item2 = 2
item3 = 3
total = item1 + \
item2 + \
item3
print(total)
#在 [], {}, 或 () 中的多行语句,不需要使用反斜杠(\)
total = {item1 +
item2 +
item3}
print(total)
'''

python中单引号和双引号使用完全相同。

使用三引号('''或""")可以指定一个多行字符串。

转义符 '\'

自然字符串, 通过在字符串前加r或R。 如 r"this is a line with \n" 则\n会显示,并不是换行。

python允许处理unicode字符串,加前缀u或U, 如 u"this is an unicode string"。

字符串是不可变的。

"""
print(r"this is a line with \n")
print(u"this id a unicode string")
#函数之间或类的方法之间用空行分隔,表示一段新的代码的开始
#按回车键后就会等待用户输入
input("\n\n请输入,按下enter键后退出。\n")
#Python可以在同一行中使用多条语句,语句之间使用分号(;)分割
import sys; x = "runoob"; sys.stdout.write(x + '\n');
#print 默认输出是换行的,如果要实现不换行需要在变量末尾加上 end=""
print('不换行a', end = " ")
print("不换行b", end = " ")
'''

缩进相同的一组语句构成一个代码块,我们称之代码组。

像if、while、def和class这样的复合语句,首行以关键字开始,以冒号( : )结束,该行之后的一行或多行代码构成代码组。

我们将首行及后面的代码组称为一个子句(clause)

'''
import sys
for i in sys.argv:
print(i)
print("\n python路径为", sys.path)
"""

在 python 用 import 或者 from...import 来导入相应的模块。

将整个模块(somemodule)导入,格式为: import somemodule

从某个模块中导入某个函数,格式为: from somemodule import somefunction

从某个模块中导入多个函数,格式为: from somemodule import firstfunc, secondfunc, thirdfunc

将某个模块中的全部函数导入,格式为: from somemodule import *

"""
from sys import path
print('path:', path)