可以用 if 语句来执行一种有条件的行动:
if 1 > 2:
message = "if only 1 were greater than two..."
elif 1 > 3:
message = "elif stands for 'else if'"
else:
message = "when all else fails use else (if you want to)"
也可以在一行语句中使用 if-then-else,我们有时候需要这么做:
parity = "even" if x % 2 == 0 else "odd"
Python 也有 while 循环:
x = 0
while x < 10:
print x, "is less than 10"
x += 1
尽管我们更常用 for 和 in:
for x in range(10):
print x, "is less than 10"
三个资料Q群下载不了也转发不了,先放这里Fine_tuning.zipLangChain.zipdata_clear.rar