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'",
''))
我正在尝试使用上面的行从文本文件中删除文本,格式
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, ...
为一些要删除的文本、更多的数字、更多的要删除的文本。没有做任何事情,.replace()
或者至少写入写入文件的内容与读取文件相同。我做错了什么?我还想删除日期之后的长整数和后续文本直到逗号,但还没有开始跨栏,因为我什至无法完成最简单的事情!