[Tutor] reading into a text file

keithabt at beyondbb.com keithabt at beyondbb.com
Sat Jul 25 21:53:19 CEST 2009


Hi I am trying to read a html document into a text file to looks at it for the 
purpose of spliting the data. I am not sure I am doing this right. I have my html 
document, my text file and a python script I called convt.py on the desktop in a 
folder. I opened up IDLE (python GUI) opened the folder on my desk top and then 
went to run module. I keep getting an error saying "No such file or 
directory: 'source.txt'
I am new to python so I really don't know if I am doing this right. Any suggestions?



#!/usr/bin/python
u=open("source.txt").read()
lines = u.split("<p><b>")
print lines[1]



More information about the Tutor mailing list