Merging two dic in python3 using Unpacking Generalisations in Python3.5
<p>There are two dictionaries as follow which I want to merge them, my point is to select those keys that I am interested in, for example I am interested in all the keys except county. Solution I 've used is using <code>del</code> function after creating your new dictionary, however I am sure there are more ways that are more efficient to my solution. How can I solve this problem without del function using <strong>UNPACKING ARGUMENT</strong>.</p>

<pre><code>    &gt;&gt;&gt; d1 =  {'avgUserperDay': '12', 'avgPurchaseperDay': '1', 'country': 'Japan'}
    &gt;&gt;&gt; d2 = {'tUser': 1, 'tPurchase': 0, 'country': 'Japan'}
    &gt;&gt;&gt; d ={**d1,**d2}
    &gt;&gt;&gt;{'tUser': 1, 'tPurchase': 0, 'avgPurchaseperDay': '1', 'avgUserperDay': '12', 'country': 'Japan'}
    &gt;&gt;&gt; del d['country']
    &gt;&gt;&gt; d
    {'tUser': 1, 'tPurchase': 0, 'avgPurchaseperDay': '1', 'avgUserperDay': '12'}
</code></pre>

<p>AFTER DISCUSSION, </p>

<p>This command works with 3.5.1,</p>

<pre><code>&gt;&gt;&gt; {**{k:v for k, v in chain(d1.items(), d2.items()) if k != 'country'}}
{'tUser': 1, 'tPurchase': 0, 'avgPurchaseperDay': '1', 'avgUserperDay': '12'}
</code></pre>

<p>If you don't want to use <code>del</code>, you can replace it by <code>.pop(key)</code>.
For example, using unpacking argument too:</p>

<pre><code>d = dict(d1, **d2)
d.pop("country")
</code></pre>

<p>Notice that <code>.pop</code> returns the value too (here "Japan").</p>

python python-3.5 argument-unpacking