[Tutor] Script to search in string of values from file A in file B

Alan Gauld alan.gauld at btinternet.com
Thu May 10 01:26:26 CEST 2012


On 09/05/12 20:28, aduarte wrote:

> Sorry it seems that I got the wrong mailing list to subscribe ...
> I got the idea that this list was open to newbies ... by the answers I
> got I see that I was wrong

I'm not sure what you mean. The answers you got seem to have provided 
the answers to your questions. What more were you expecting?

> after chatting in other mailing lists about other languages I realized
> that this mailing list is not in my league for python ...

Which league is that? You said you were a beginner so you got answers 
appropriate to a beginner. If you said you were an experienced data 
processing professional looking for a smart/efficient way to process 
large files using Python you would likely have gotten different answers.
If the answers were too advanced then by all means ask for 
clarification. We can only guess your level based on what you post.

> Interestingly I did got a strange advice from this list: try awk ... of
> Perl for the job, as Python is kind of tricky to print the next line

I didn't see that suggestion and I disagree with it.
Python is just as capable of processing files as awk or Perl as I hope 
the other answers have demonstrated. But where another tool is more 
appropriate there is no harm in suggesting it. Just because this is a 
Python list doesn't mean the answer needs to be Python.

> that you selected (yes that was my question and I still don't understand
> how ppl advise me to insert new lines in 500Mb files and so on to do it...)

Again I'm not sure that anyone is actually suggesting you insert new 
lines into your file. It's certainly not the general advice being given.

But this is a list for beginners and the people giving the advice
range from complete novices themselves to working pro's. The answers 
reflect that diversity.

In your case the majority of the answers have come from experienced
programmers giving you sound advice and probing your requirements to
ensure that all your use cases are covered. The only slightly
radical suggestion I can see is to read the files into memory - and on a 
modern PC that's not too radical for a 500M file even though I'd 
probably not do it myself...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list