In <[email protected]> Igor Korot
<[email protected]> writes:
> --047d7b6dc250a1426004f3bffd8d
> Content-Type: text/plain; charset=ISO-8859-1
> Hi, ALL,
> I have a csv file which depending on how it was produced gives 2 different
> strings as shown in the example below (test1 and test2).
> I am only interested in the first field in test1 and obviously in the whole
> string of test2.
> So, I tried to see if I can get what I want in one simple way, but failed.
> Is it possible to process the file independently?
> Thank you.
split() returns a list. Use indexing to grab only the element you want,
like this:
t1 = test1.split(',')[0]
t2 = test2.split(',')[0]
--
John Gordon Imagine what it must be like for a real medical doctor to
[email protected] watch 'House', or a real serial killer to watch 'Dexter'.
--
https://mail.python.org/mailman/listinfo/python-list