how do you manipulate text files..
import urllib2 dload = urllib2.Request('http://tvnz.co.nz/content/tv2_listings_data/portable_listings_skin') text_file = urllib2.urlopen(dload) text_file_read = text_file.read() print text_file_read f = open ('site.txt', 'w' f.write(text_file_read) f.close()
This returns the page and saves it as text file, but how would i do the following things..
-delete lines of texts, for example say delete from lines 1-10.
-Return/delete everything between '<body>' and '</body>' etc.
-search and delete all '<b>' and </b> etc?
I've read about 'parsers' but not quite sure how to use them but either way wouldn't this way be easier?