#!/usr/bin/python
#filename:break.py
while True:
s = input('enter something:')
s = s.replace('\r','')
if s == 'quit':
break
print('length of the string is',len(s))
print('done')
print
这里注意一下,执行时必须使用python3
当输入的字符串为 quit时,就执行break跳出循环