Read csv file and create a new file

Joel Goldstick joel.goldstick at gmail.com
Thu Feb 28 14:34:12 EST 2013


On Thu, Feb 28, 2013 at 2:14 PM, io <maroso at libero.it> wrote:

> Hi,
>
> i have to files.
>
> First file is a csv file
> Second file is a plain text file where each row has a value (text)
>

Read the second file so that you have a list of each of its values

Read the first file line by line.  Check if the value at the beginning of
the line is in the list of values from the second file.  If not, print it
to outfile.

You should look up split method on strings to split a string separated by
whitespace.

>
> I want to be able to create a third file using data from the first file
> excluding the values listed in the second file.
>
> Example:
>
> First file:
> -----------
>
> mtgoxeur        12      24      36
> mtgoxusd        10      12      14
> mtgoxpln        2       4       6
>
>
> Second file:
> ------------
>
> mtgoxusd
>
>
>
> Third File (the resulting one) :
> --------------------------------
>
> mtgoxeur        12      24      36
> mtgoxpln        2       4       6
>
>
>
> Thanks to anyone that can help
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130228/09134d3e/attachment.html>


More information about the Python-list mailing list