0

A riddle of sorts….I have two text similar text files containing file paths for data that I have downloaded and another for data that I would like to download as part of an automated periodic process. I would however only like to download the new files (the set of 3 that is contained in Text 2 and absent in Text 1). Is there a way to compare and effectively difference two texts using difflib in python yielding a third text containing only the amalgamated difference? Much thanks in advance. Chase CB

////////Text 1///Old///

/Users/MacBookPro15/1.txt

/Users/MacBookPro15/2.txt

/Users/MacBookPro15/3.txt

////Text 2//////New///

/Users/MacBookPro15/1.txt

/Users/MacBookPro15/2.txt

/Users/MacBookPro15/3.txt

/Users/MacBookPro15/4.txt

/Users/MacBookPro15/5.txt

/Users/MacBookPro15/6.txt

///What I want////Differenced

/Users/MacBookPro15/4.txt

/Users/MacBookPro15/5.txt

/Users/MacBookPro15/6.txt

Petros Koutsolampros
  • 2,790
  • 1
  • 14
  • 20
Chase CB
  • 1,561
  • 1
  • 13
  • 20
  • 1
    What have you tried so far, do you have some code? Also, how large are these files? I think it should be relatively easy to implement something using [`(frozen)set`](http://docs.python.org/2/library/stdtypes.html#frozenset)s, though I don't know if they scale to monstrous datasets. – m01 Jan 18 '14 at 17:37
  • havent tried anything yet never really had to do something like this. i don't think the data set is prohibitively large. many thanks for the response. – Chase CB Jan 18 '14 at 21:26
  • the set stuff worked very nicely. thanks again. – Chase CB Jan 18 '14 at 21:54

0 Answers0