savetonotherfile.write(
openfileagain.read().replace(
"b'<HTML>\n<HEAD>\n<TITLE> Euro Millions Winning Numbers</TITLE>\n<BODY>\n<PRE> Euro Millions Winning Numbers\n\nNo., Day,DD,MMM,YYYY, N1,N2,N3,N4,N5,L1,L2, Jackpot, Wins\n",
'').replace(
"\n<HR><B>All lotteries below have exceeded the 180 days expiry date</B><HR>No., Day,DD,MMM,YYYY, N1,N2,N3,N4,N5,L1,L2, Jackpot, Wins\n",
'').replace(
"\n\nThis page shows all the draws that used any machine and any ball set in any year.\n\nData obtained from http://lottery.merseyworld.com/Euro/\n</PRE>\n</BODY></HTML>\n'",
''))
I am trying to use the above line to delete text from a text file in the format
b'<HTML>\n<HEAD>\n<TITLE> Euro Millions Winning Numbers</TITLE>\n<BODY>\n<PRE> Euro Millions Winning Numbers\n\nNo., Day,DD,MMM,YYYY, N1,N2,N3,N4,N5,L1,L2, Jackpot, Wins\n562, Fri, 8,Feb,2013, 09,11,14,34,44,10,11, 27886637, 0\n561, Tue, 5,Feb,2013, 06,25,31,40,45,06,07, 19070109, 0\n560, Fri, 1,Feb,2013, ...
some text to delete, more numbers, some more text to delete. The .replace()
is not doing anything or at least what is written to the write file is identical to the read file. What have I done wrong? I also want to delete the long integer and subsequent text up to the comma after the date, but haven't even started on that hurdle, since I cannot even accomplish the simplest thing!