Best algorithm to compare list or dict
<p>I'm dealing with a bit complicated data set via Python. I'm a novice Python coder. The data set is the collection of Date, Title, Contents and URL.</p>

<p>Conceptually, it will be like this.</p>

<pre><code>1st scraping runs, then I get,

[9/6 9:00, title1, content1]
[9/6 9:00, title2, content2]
[9/6 8:22, title3, content3]
[9/6 11:01, title4, content4]
...

2nd scraping runs, then I get,

[9/6 13:05, title5, content5]
[9/6 12:13, title6, content6]
[9/6 9:00, title1, content1]
[9/6 14:21, title4, content4'] ---&gt; This is updated of content4
...
</code></pre>

<p>I could run scraping code.
What I want to do is to compare the output of 1st scraping run and 2nd. 
I expect to show only diff.</p>

<pre><code>[9/6 13:05, title5, content5]
[9/6 12:13, title6, content6]
[9/6 10:21, title4', content4']
</code></pre>

<p>I don't believe I have to compare "content". 
I can get the diff by "date" and "title" only.</p>

<p>I spent hours but cannot think of elegant approach to make this work..
What would be the best approach here? Basically, I'm thinking to store the output as pickle then compare the 2nd scrape run output on the fly. However, I'm not sure how to compare to get two elements of list simultaneously then compare with two elements from second list. It does not seem it is simple for loop...</p>

<p>Or, can this be done by dict?  I don't think so... but welcome to any suggestion.</p>

<p>It will be much appreciated if experienced folks could comment.</p>

<p>Did you try something like that?</p>

<pre><code>&gt;&gt;&gt; common_elements = []
&gt;&gt;&gt; a = [['date', 'title1', 'content1'], ['date2', 'title2', 'content2']]
&gt;&gt;&gt; b = [['date3', 'title3', 'content3'], ['date2', 'title2', 'content2']]
&gt;&gt;&gt; for element in a:
...     if element in b:
...         common_elements.append(element)
... 
&gt;&gt;&gt; common_elements
[['date2', 'title2', 'content2']]
</code></pre>

python python-3.x compare