找个乐子!python代码是从上往下阅读的很明显,但是怎么验证每行代码是从左往右读的?
尽量用最简单的方法{:10_289:} 本帖最后由 liuzhengyuan 于 2018-6-30 14:35 编辑static/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.png
很简单,凭直觉{:5_91:}
static/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.pngstatic/image/hrline/line7.png
没人玩吗??{:10_266:} liuzhengyuan 发表于 2018-6-30 14:15
很简单,凭直觉
贵族专用字体颜色 没有定义nn按理说要出错,但是实际没有出错,因为运行到 i==1就直接运行下一步了
i = 1
if i == 1 or nn == 1:
print(1) Python中一般是一行写完所有代码,如果遇到一行写不完需要换行的情况,有两种方法:
1.在该行代码末尾加上续行符“ \”(即空格+\);
test = 'item_one' \
'item_two' \
'tem_three'
输出结果:'item_oneitem_twotem_three'
2.加上括号,() {}[]中不需要特别加换行符:
test2 = ('csdn '
'cssdn')
输出结果:csdn cssdn
if...and:
if (where there is a will and
there is a way)
多次未输出结果
test3 =('Hello'
' '
'world')
输出结果:Hello world print(lst)==lst.reverse()
会先打印,再翻转,所以说是从左往右的。
页:
[1]