python 学习小结 python 简明教程 1.python 文件 #!/etc/bin/python #coding=utf-8 2.main()函数 if __name__ == '__main__': 3.物理行与逻辑行; 下面是一个在多个物理行中写一个逻辑行的例子.它被称为明确的行连接. s = 'This is a string. \ This continues the string.' print s 它的输出: This is a string. This continues…
if语句 if语句中,代码块是按缩进的空格数量来判断的,也就是说空格数量一致的相邻行会被当作一个代码块,当if的条件成立的时候它就会得到执行. x = 100 if x > 50: print 'x is high, ' print 'and high up in the sky!' elif x == 50: print 'x is middle' else: print 'x is low' while语句 Python的循环中也有break和continue.而且还添加了一个很方便的els…