barronmo wrote:

> I'm having difficulty getting the following code to work.  All I want
> to do is remove the '0:00:00' from the end of each line.  Here is part
> of the original file:
> 
> 3,3,"Dyspepsia NOS",9/12/2003 0:00:00
>...
> 20,3,"Bubonic plague",11/11/2003 0:00:00
> 
> output = open('my/path/ProblemListFixed.txt', 'w')
> for line in open('my/path/ProblemList.txt', 'r'):
>      newline = line.rstrip('0:00:00')
>      output.write(newline)
> output.close()
> 
> 
> This result is a copy of "ProblemList" without any changes made.  What
> am I doing wrong?  Thanks for any help.

You should feel lucky that it didn't work :-) If you would have used
    newline = line.rstrip('0:00:00\n')
you would not have found the problem, nor the solution.
--
Kees

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to