#!/usr/bin/python

poem = '''\
Programming is run
When the work is done
if you wanna make your work also fun:
        using python
'''

f = file('poem.txt', 'w')
f.write(poem)
f.close()

f = file('poem.txt', 'r')
while True:
        lineText = f.readline()
        if 0 == len(lineText):
                break;
        print lineText,
f.close()


#!/usr/bin/python

import cPickle as p

alibaba = ['taobao', 'alipay', 'tmall', 'aliyun', 'cainiao', '1688']

f = file('ali88.data', 'w')
p.dump(alibaba, f)
f.close()

del alibaba

f = file('ali88.data')
alibaba = p.load(f)
f.close()

print alibaba


Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐