{k: v <spanclass="hljs-keyword">for</span> k, v <spanclass="hljs-keyword">in</span><dict>.items() <spanclass="hljs-keyword">if</span> k <spanclass="hljs-keyword">in</span> keys} <spanclass="hljs-comment"># Filters dictionary by keys.</span>
{k: v <spanclass="hljs-keyword">for</span> k, v <spanclass="hljs-keyword">in</span><dict>.items() <spanclass="hljs-keyword">if</span> k <spanclass="hljs-keyword">in</span> keys} <spanclass="hljs-comment"># Filters dictionary by keys.</span>
<li><strong>Search() and match() return None if there are no matches.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.IGNORECASE'</span></code> can be used with all functions.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.IGNORECASE'</span></code> can be used with all functions.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.MULTILINE'</span></code> makes <codeclass="python hljs"><spanclass="hljs-string">'^'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'$'</span></code> match the start/end of each line.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.MULTILINE'</span></code> makes <codeclass="python hljs"><spanclass="hljs-string">'^'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'$'</span></code> match the start/end of each line.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.DOTALL'</span></code> makes dot also accept newline.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.DOTALL'</span></code> makes dot also accept newline.</strong></li>
@ -660,14 +661,14 @@ shuffle(<list>)
</ul>
</ul>
<div><h3id="timezone">Timezone</h3><pre><codeclass="python language-python hljs"><tzinfo> = UTC <spanclass="hljs-comment"># UTC timezone. London without DST.</span>
<div><h3id="timezone">Timezone</h3><pre><codeclass="python language-python hljs"><tzinfo> = UTC <spanclass="hljs-comment"># UTC timezone. London without DST.</span>
<tzinfo> = tzlocal() <spanclass="hljs-comment"># Local timezone. Also gettz().</span>
<tzinfo> = tzlocal() <spanclass="hljs-comment"># Local timezone. Also gettz().</span>
<tzinfo> = gettz(<spanclass="hljs-string">'<Cont.>/<City>'</span>) <spanclass="hljs-comment"># Timezone from 'Continent/City_Name' str.</span>
<tzinfo> = gettz(<spanclass="hljs-string">'<Cont.>/<City>'</span>) <spanclass="hljs-comment"># 'Continent/City_Name' timezone or None.</span>
<Ta/DTa> = <T/DT>.replace(tzinfo=<tzinfo>) <spanclass="hljs-comment"># Unconverted object with new timezone.</span>
<Ta/DTa> = <T/DT>.replace(tzinfo=<tzinfo>) <spanclass="hljs-comment"># Unconverted object with new timezone.</span>
</code></pre>
</code></pre>
<div><h3id="encode">Encode</h3><pre><codeclass="python language-python apache hljs"><D/T/DT> = D/T/DT.fromisoformat(<spanclass="hljs-string">'<iso>'</span>) <spanclass="hljs-comment"># Object from ISO string.</span>
<DT> = DT.strptime(<str>, <spanclass="hljs-string">'<format>'</span>) <spanclass="hljs-comment"># Datetime from str, according to format.</span>
<div><h3id="encode">Encode</h3><pre><codeclass="python language-python apache hljs"><D/T/DT> = D/T/DT.fromisoformat(<spanclass="hljs-string">'<iso>'</span>) <spanclass="hljs-comment"># Object from ISO string. Raises ValueError.</span>
<DT> = DT.strptime(<str>, <spanclass="hljs-string">'<format>'</span>) <spanclass="hljs-comment"># Datetime from str, according to format.</span>
<D/DTn> = D/DT.fromordinal(<int>) <spanclass="hljs-comment"># D/DTn from days since Christ, at midnight.</span>
<D/DTn> = D/DT.fromordinal(<int>) <spanclass="hljs-comment"># D/DTn from days since Christ, at midnight.</span>
<DTn> = DT.fromtimestamp(<real>) <spanclass="hljs-comment"># Local time DTn from seconds since Epoch.</span>
<DTn> = DT.fromtimestamp(<real>) <spanclass="hljs-comment"># Local time DTn from seconds since Epoch.</span>
<DTa> = DT.fromtimestamp(<real>, <tz.>) <spanclass="hljs-comment"># Aware datetime from seconds since Epoch.</span>
<DTa> = DT.fromtimestamp(<real>, <tz.>) <spanclass="hljs-comment"># Aware datetime from seconds since Epoch.</span>
<pre><codeclass="python language-python hljs"><member> = <enum>.<member_name><spanclass="hljs-comment"># Returns a member.</span>
<member> = <enum>[<spanclass="hljs-string">'<member_name>'</span>]<spanclass="hljs-comment"># Returns a member or raises KeyError.</span>
<member> = <enum>(<value>)<spanclass="hljs-comment"># Returns a member or raises ValueError.</span>