[root@chenbj test]# python
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> counter=0
>>> while counter<10:
... print "Loop number: %s" % counter
... counter += 1
...
Loop number: 0
Loop number: 1
Loop number: 2
Loop number: 3
Loop number: 4
Loop number: 5
Loop number: 6
Loop number: 7
Loop number: 8
Loop number: 9
转载于:https://www.cnblogs.com/aofo/p/7483856.html