[Tutor] Append function

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Jan 31 08:56:30 CET 2005



On Sun, 30 Jan 2005, kumar s wrote:

> I have a bunch of files where the first column is always the same. I
> want to collect all those files, extract the second columns by file wise
> and write the first column, followed by the other columns(extracted from
> files) next to each other.


Hi Kumar,


Can you show us an example of what you mean?

I think you're looking for something takes a list of line elements, like

###
lines = """
1	Alpha
1	Beta
1	Gamma
1	Delta
1	Epsilon
""".split('\n')
###

and combines input lines with the same first column into something like
this:

###
1	Alpha|Beta|Gamma|Delta|Epsilon
###


But I'm not positive if something like this is what you're trying to do.
You mentioned multiple files: can you show us a small, simple example with
two files?


An example like this will help clarify the problem, and help us know if
we're really answering your question.


Best of wishes to you!



More information about the Tutor mailing list