CSUIDL PROGRAMMEr wrote: > Folks > I am trying to read a file > This file has a line containing string 'disable = yes' > > I want to change this line to 'disable = no' > > The concern here is that , i plan to take into account the white spaces > also. > > I tried copying all file int list and then tried to manipulate that > list > > But the search is not working > > Any answer > > thanks > Something simple like (not tested):
fp=open(filename, 'r') data=fp.read() fp.close() data='disable = yes'.join(data.split('disable = no',1)) fp=open(filename, 'w') fp.write(data) fp.close() -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list