arwer13 / compsci

2 stars 1 forks source link

Problems with program and strip() #10

Open RyanMcCarl opened 8 years ago

RyanMcCarl commented 8 years ago

Hi Artyom,

I tried to modify my text de-duplication program, which removes duplicate lines from a text file, to remove whitespace before considering whether a line is a duplicate. I used .strip() to do this. Before adding .strip(), the program was missing some duplicate lines. After adding .strip(), it deleted every line! What went wrong?

Thanks, Ryan textdeduplicator.txt

arwer13 commented 8 years ago

Hi! line.strip() doesn't change line, it returns a copy of line with spaces truncated