Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2, codecs, os
- txt = urllib2.urlopen('http://www.unicode.org/udhr/d/udhr_bba.txt').read()
- with codecs.open('test.txt','w','utf8') as fout:
- print>>fout, txt
- print len(codecs.open('test.txt','r','utf8').readlines())
- with codecs.open('test.txt','r','utf8') as fin:
- for _ in range(5): fin.readline()
- print len(fin.readlines())+5
- os.remove('test.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement