最新回答 / 慕粉162258448
我觉得会不会有这两个因素:一方面break比较容易做调试,灵活的变更条件结束循环;另一方面,break在循环体内,判断成立后下面的语句不会再执行,而while一定要上一次结束后再判断
2017-01-04
最新回答 / qq_难忘_0
不知为啥,在我的python2中就允许这样输入# -*- coding: utf-8 -*-print u'''静夜思床前明月光,疑是地上霜。举头望明月,低头思故乡。'''
2017-01-04
print r'''"To be,or not to be":
that is the question.
Whether it's nobler in the mind to suffer.'''
that is the question.
Whether it's nobler in the mind to suffer.'''
2017-01-04
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s
print s
2017-01-04
# -*- coding: utf-8 -*-
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2017-01-04
>>> r'\(~_~)/ \(~_~)/'
'\\(~_~)/ \\(~_~)/'
>>> print r'\(~_~)/ \(~_~)/'
\(~_~)/ \(~_~)/
>>> '\(~_~)/ \(~_~)/'
'\\(~_~)/ \\(~_~)/'
加不加r 都一样的结果,加了print 才是想要的结果呢
Python 2.7.12
'\\(~_~)/ \\(~_~)/'
>>> print r'\(~_~)/ \(~_~)/'
\(~_~)/ \(~_~)/
>>> '\(~_~)/ \(~_~)/'
'\\(~_~)/ \\(~_~)/'
加不加r 都一样的结果,加了print 才是想要的结果呢
Python 2.7.12
2017-01-04
print [int(str(m)+str(n)+str(m)) for m in range(1,10) for n in range(0,10) ]
2017-01-04
should be sum_of_square. A little bit confused about the function name.
2017-01-04