#coding=utf8
s = u'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
'''
print s.encode('utf8')
s = u'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
'''
print s.encode('utf8')
2015-12-06
# -*- coding: utf-8 -*-
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2015-12-06
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
Whether it's nobler in the mind to suffer.'''
2015-12-06
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s
print s
2015-12-06
x1 = 1
d = 3
n = 100
x100 = x1+d*99
s = n*(x1+x100)/2
print s
s=14950
d = 3
n = 100
x100 = x1+d*99
s = n*(x1+x100)/2
print s
s=14950
2015-12-06
def greet(x='world'):
print 'hello',x
greet()
greet('bart')
print 'hello',x
greet()
greet('bart')
2015-12-06
t = ('a', 'b', ('A', 'B'))
print t
print t
2015-12-05
s = set(['Adam', 'Lisa','Bart', 'Paul'])
print s
print len(s);
print s
print len(s);
2015-12-05
下面的代码与任务不符,重发一遍
方法1(推荐):
d = {'Adam':95,'Lisa':85,'Bart':59}
#d['Paul']=75
for k,v in d.items():
print k,':',v
方法二:
d = {'Adam':95,'Lisa':85,'Bart':59}
#d['Paul']=75
for k,v in d.items():
print k+":"+str(v)
方法1(推荐):
d = {'Adam':95,'Lisa':85,'Bart':59}
#d['Paul']=75
for k,v in d.items():
print k,':',v
方法二:
d = {'Adam':95,'Lisa':85,'Bart':59}
#d['Paul']=75
for k,v in d.items():
print k+":"+str(v)
2015-12-04