我第一行不加#-*-coding:utf-8 -*-也能正常运行啊,如下代码,哪位大神能解释下吗?十分感谢!
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2017-01-21
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-21
class range(object)
| range(stop) -> range object range(start, stop[, step]) -> range object
| Return an object that produces a sequence of integers from start (inclusive)
| to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1.
| range(stop) -> range object range(start, stop[, step]) -> range object
| Return an object that produces a sequence of integers from start (inclusive)
| to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1.
2017-01-21
s = set(['Adam','Lisa','Bart','Paul']) 就搞定了
任务出的有点水,不能让人更深刻理解本节的内涵与章节之间的联系
任务出的有点水,不能让人更深刻理解本节的内涵与章节之间的联系
2017-01-21
#按照要求来
print [x*100 + y*10 + z for x in range(1,10) for y in range(0,10)
for z in range(1,10) if x==z]
#print [x for x in range(100,1000) if x/100 ==x%10]
print [x*100 + y*10 + z for x in range(1,10) for y in range(0,10)
for z in range(1,10) if x==z]
#print [x for x in range(100,1000) if x/100 ==x%10]
2017-01-20
def toUppers(L):
return [x.upper() for x in L if isinstance(x,str)]
print toUppers(['Hello', 'world', 101])
return [x.upper() for x in L if isinstance(x,str)]
print toUppers(['Hello', 'world', 101])