added 5 new articles

This commit is contained in:
Guillaume Redoulès 2019-08-14 21:42:29 +02:00
parent 80f2eb9e98
commit b6343044b6
98 changed files with 1255 additions and 93 deletions

View File

@ -185,7 +185,7 @@ Mean : 43117.75, Median : 44627.5, Mode : 4978
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -219,7 +219,7 @@ Q1 : 6.0, Q2 : 12, Q3 : 16.0
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -429,7 +429,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -256,7 +256,7 @@ we call B the event "a blue ball is drawn" and R the event "a red ball is drawn"
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -311,7 +311,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -331,7 +331,7 @@ Between 20 and 22 hours?</p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -270,7 +270,7 @@ B = 515.68
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -272,7 +272,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -277,7 +277,7 @@ $$</div>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -275,7 +275,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -286,7 +286,7 @@ maxuploadtarget=5000
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -161,7 +161,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -365,7 +365,7 @@ Mayer multiple average 1.3789102045356179
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -279,7 +279,7 @@ Epoch 5/5
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -161,7 +161,7 @@ _________________________________________________________________
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -149,7 +149,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -152,7 +152,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -154,7 +154,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -235,7 +235,7 @@ Epoch 5/5
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -280,7 +280,7 @@ Epoch 5/5
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -382,6 +382,8 @@
</div>
<div class="panel-body">
<ul>
<li><a href="./python/case_config.html">Case sensitive ConfigParser</a></li>
<li><a href="./python/write_config_file.html">Write a value to a config file</a></li>
<li><a href="./python/config_parse.html">Parse variable from config file</a></li>
<li><a href="./python/randint.html">Random integer</a></li>
<li><a href="./python/counting.html">Counting values in an array</a></li>
@ -491,6 +493,8 @@
</div>
<div class="panel-body">
<ul>
<li><a href="./python/maximize_window.html">Maximize a window in Windows</a></li>
<li><a href="./python/iterate_dict.html">Iterate over a dictionnary</a></li>
<li><a href="./python/Optimized_numpy_random_intel.html">Optimized numpy random number generation on Intel CPU</a></li>
<li><a href="./python/updating_all_python_package_with_anaconda.html">Updating all python package with anaconda</a></li>
</ul>
@ -704,7 +708,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 92 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -149,7 +149,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -211,7 +211,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -144,7 +144,7 @@ However, you can use the following command to do it </p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -143,7 +143,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -203,7 +203,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -148,7 +148,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -167,7 +167,7 @@ none 0 0 0 - /config
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -256,7 +256,7 @@ wifi0 Link encap:UNSPEC HWaddr 5C-51-4F-41-7A-AD-00-00-00-00-00-00-00-00-00
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -172,7 +172,7 @@ USER;PID;%CPU;%MEM;VSZ;RSS;TTY;STAT;START;TIME;COMMAND</p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -158,7 +158,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -169,7 +169,7 @@ dd <span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">o
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -494,7 +494,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -151,7 +151,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -208,7 +208,7 @@ The secret number is 126
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -160,7 +160,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -234,7 +234,7 @@ Where Y=a+b*X
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -248,7 +248,7 @@ b_2\\
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -1033,7 +1033,7 @@ Top dislike features:
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 92 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -196,7 +196,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -256,7 +256,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -233,7 +233,7 @@ So :
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -214,7 +214,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -195,7 +195,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -203,7 +203,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -197,7 +197,7 @@ and B are considered to be independent if event A has no effect on the probabili
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -221,7 +221,7 @@ where <span class="math">\(erf\)</span> is the error function:
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -206,7 +206,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -222,7 +222,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -223,7 +223,7 @@ $$</div>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -145,7 +145,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 92 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -192,7 +192,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -241,7 +241,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -235,7 +235,7 @@ At line 5 there is a plum which is purple and contains 28 kcal
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -378,7 +378,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -168,7 +168,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -192,7 +192,7 @@ If you try to open a non existing file in read mode 'r', a FileNotFoundError wil
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -176,7 +176,7 @@ conda install numpy --channel intel --override-channels
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -208,7 +208,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -237,7 +237,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -186,7 +186,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -171,7 +171,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -339,7 +339,7 @@ However, exporting to a sql database can prove very useful. Indeed, having a wel
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

195
python/case_config.html Normal file
View File

@ -0,0 +1,195 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Case sensitive ConfigParser - Python</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Basics" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Case sensitive ConfigParser
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2019-08-09T11:31:00+02:00">
09 août 2019
</time>
</li>
<li>Python</li>
<li>Basics</li>
</ol>
</header>
<div class='article_content'>
<p>In order to have a case sensite ConfigParser, simply replace the ConfigParser with the following class :</p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">configparser</span> <span class="kn">import</span> <span class="n">ConfigParser</span>
<span class="k">class</span> <span class="nc">CaseConfigParser</span><span class="p">(</span><span class="n">ConfigParser</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">optionxform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">optionstr</span><span class="p">):</span>
<span class="k">return</span> <span class="n">optionstr</span>
</pre></div>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -169,7 +169,7 @@ myvariable: 42
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -181,7 +181,7 @@ The number 4 appears 1 times in the list
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -338,7 +338,7 @@ http://127.0.0.1:8787/status</p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -148,7 +148,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -232,7 +232,7 @@ The list of dependencies required to test, build and generate the doc are listed
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -164,7 +164,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -218,7 +218,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -177,7 +177,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

207
python/iterate_dict.html Normal file
View File

@ -0,0 +1,207 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Iterate over a dictionnary - Python</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Other" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Iterate over a dictionnary
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2019-08-09T11:40:00+02:00">
09 août 2019
</time>
</li>
<li>Python</li>
<li>Other</li>
</ol>
</header>
<div class='article_content'>
<p>To iterate over a dictionnary in a for loop, you have to use the following syntaxe </p>
<div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
</pre></div>
<p>Here is a examples printing the keys and values of a dictionnary</p>
<div class="highlight"><pre><span></span><span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;key1&quot;</span><span class="p">:</span><span class="s2">&quot;value 1&quot;</span><span class="p">,</span> <span class="s2">&quot;key2&quot;</span><span class="p">:</span> <span class="s2">&quot;value 2&quot;</span><span class="p">,</span> <span class="s2">&quot;key3&quot;</span> <span class="p">:</span><span class="s2">&quot;value 3&quot;</span><span class="p">}</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;{key} : {value}&#39;</span><span class="p">)</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="n">key1</span> <span class="o">:</span> <span class="n">value</span> <span class="mi">1</span>
<span class="n">key2</span> <span class="o">:</span> <span class="n">value</span> <span class="mi">2</span>
<span class="n">key3</span> <span class="o">:</span> <span class="n">value</span> <span class="mi">3</span>
</pre></div>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -213,7 +213,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

266
python/list_windows.html Normal file
View File

@ -0,0 +1,266 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Liste all opened windows on Windows - Python</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Other" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Liste all opened windows on Windows
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2019-08-03T11:36:00+02:00">
03 août 2019
</time>
</li>
<li>Python</li>
<li>Other</li>
</ol>
</header>
<div class='article_content'>
<p>You can use the function <code>get_all_windows</code> to get a dictonnary containing the titles of the opened windows as keys and the handles of those windows as values</p>
<div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">win32gui</span>
<span class="k">def</span> <span class="nf">get_all_windows</span><span class="p">():</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Returns dict with window desc and hwnd,</span>
<span class="sd">  &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">_MyCallback</span><span class="p">(</span> <span class="n">hwnd</span><span class="p">,</span> <span class="n">extra</span> <span class="p">):</span>
<span class="n">hwnds</span><span class="p">,</span> <span class="n">classes</span> <span class="o">=</span> <span class="n">extra</span>
<span class="n">hwnds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">hwnd</span><span class="p">)</span>
<span class="n">classes</span><span class="p">[</span><span class="n">win32gui</span><span class="o">.</span><span class="n">GetWindowText</span><span class="p">(</span><span class="n">hwnd</span><span class="p">)]</span> <span class="o">=</span> <span class="n">hwnd</span>
<span class="n">windows</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">classes</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">win32gui</span><span class="o">.</span><span class="n">EnumWindows</span><span class="p">(</span><span class="n">_MyCallback</span><span class="p">,</span> <span class="p">(</span><span class="n">windows</span><span class="p">,</span> <span class="n">classes</span><span class="p">))</span>
<span class="k">return</span> <span class="n">classes</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="n">get_all_windows</span><span class="p">()</span>
</pre></div>
<div class="highlight"><pre><span></span>{&#39;&#39;: 3802422,
&#39;Forcepad driver tray window&#39;: 65676,
&#39;Jauge de batterie&#39;: 131542,
&#39;Network Flyout&#39;: 131650,
&#39;Dashlane&#39;: 5570658,
&#39;Wox&#39;: 131770,
&#39;JupyterLab - Brave&#39;: 66990,
&#39;python&#39;: 4261478,
&#39;Visual Studio Code - Insiders&#39;: 329780,
&#39;Code - Insiders&#39;: 526478,
&#39;Documents&#39;: 526010,
&#39;Windows PowerShell&#39;: 198580,
&#39;Progression&#39;: 394934,
&#39;Microsoft Edge&#39;: 131586,
&#39;Microsoft Store&#39;: 197328,
&#39;QTrayIconMessageWindow&#39;: 327816,
&#39;Hidden Window&#39;: 459506,
&#39;.NET-BroadcastEventWindow.4.0.0.0.3e2c690.0&#39;: 131824,
&#39;SystemResourceNotifyWindow&#39;: 197346,
&#39;MediaContextNotificationWindow&#39;: 197344,
&#39;Resilio Sync 2.6.3&#39;: 262934,
</pre></div>
<p>}</p>
<div class="highlight"><pre><span></span><span class="k">print</span><span class="p">(</span><span class="s2">&quot;List of all opened windows : &quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">get_all_windows</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="n">key</span> <span class="o">!=</span> <span class="s2">&quot;&quot;</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\t</span><span class="s2">* &quot;</span> <span class="o">+</span> <span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
</pre></div>
<div class="highlight"><pre><span></span>List of all opened windows :
* Forcepad driver tray window
* Jauge de batterie
* Network Flyout
* Dashlane
* Wox
* JupyterLab - Brave
* python
* Visual Studio Code - Insiders
* Code - Insiders
* Documents
* Windows PowerShell
* Progression
* Microsoft Edge
* Microsoft Store
* QTrayIconMessageWindow
* Hidden Window
* .NET-BroadcastEventWindow.4.0.0.0.3e2c690.0
* SystemResourceNotifyWindow
* MediaContextNotificationWindow
* Resilio Sync 2.6.3
</pre></div>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -248,7 +248,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

237
python/maximize_window.html Normal file
View File

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Maximize a window in Windows - Python</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Other" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Maximize a window in Windows
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2019-08-12T11:31:00+02:00">
12 août 2019
</time>
</li>
<li>Python</li>
<li>Other</li>
</ol>
</header>
<div class='article_content'>
<p>A window can be maximized by using the win32 API. We will need to import <code>win32gui</code> and <code>win32con</code></p>
<div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">win32gui</span>
<span class="kn">import</span> <span class="nn">win32con</span>
</pre></div>
<p>In order to maximize a windows, we need its handle number. In our example we will get the handle of the foreground window by using the GetForegroundWindow method.</p>
<div class="highlight"><pre><span></span><span class="n">handle</span> <span class="o">=</span> <span class="n">win32gui</span><span class="o">.</span><span class="n">GetForegroundWindow</span><span class="p">()</span>
</pre></div>
<p>The window can then be maximized with the command </p>
<div class="highlight"><pre><span></span><span class="n">win32gui</span><span class="o">.</span><span class="n">ShowWindow</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="n">win32con</span><span class="o">.</span><span class="n">SW_MAXIMIZE</span><span class="p">)</span>
</pre></div>
<div class="highlight"><pre><span></span>24
</pre></div>
<p>minimized with the command </p>
<div class="highlight"><pre><span></span><span class="n">win32gui</span><span class="o">.</span><span class="n">ShowWindow</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="n">win32con</span><span class="o">.</span><span class="n">SW_MINIMIZE</span><span class="p">)</span>
</pre></div>
<div class="highlight"><pre><span></span>24
</pre></div>
<p>or restored to its original size with the command</p>
<div class="highlight"><pre><span></span><span class="n">win32gui</span><span class="o">.</span><span class="n">ShowWindow</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="n">win32con</span><span class="o">.</span><span class="n">SW_NORMAL</span><span class="p">)</span>
</pre></div>
<div class="highlight"><pre><span></span>24
</pre></div>
<p>The win32 API allow to hide or show a window. </p>
<div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">time</span>
<span class="n">win32gui</span><span class="o">.</span><span class="n">ShowWindow</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="n">win32con</span><span class="o">.</span><span class="n">SW_HIDE</span><span class="p">)</span> <span class="c1">#hide the window</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1">#keep it hidden for a second</span>
<span class="n">win32gui</span><span class="o">.</span><span class="n">ShowWindow</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="n">win32con</span><span class="o">.</span><span class="n">SW_SHOW</span><span class="p">)</span> <span class="c1">#show the window</span>
</pre></div>
<div class="highlight"><pre><span></span>0
</pre></div>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -181,7 +181,7 @@ dtype: Int64
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -237,7 +237,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -156,7 +156,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -647,7 +647,7 @@ you also need to specify the axis.</p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -173,7 +173,7 @@ Reversed array : [4 3 2 1 0]
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -288,7 +288,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -359,7 +359,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -192,7 +192,7 @@ Sorted array : [0.13876208 0.19939047 0.40021786 0.43734158 0.46015169]
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -381,7 +381,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -171,7 +171,7 @@ Numpy array with unique values : [10 20 30 40 50 60]
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -151,7 +151,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Write a value to a config file - Python</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Basics" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Write a value to a config file
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2019-08-09T11:17:00+02:00">
09 août 2019
</time>
</li>
<li>Python</li>
<li>Basics</li>
</ol>
</header>
<div class='article_content'>
<p>You can store variables in an ini file for later executions of the script instead of hardcoding the values in the script. ConfigParser can take a pointer to a file an write values to that file using the ini syntaxe</p>
<div class="highlight"><pre><span></span><span class="n">config</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="p">()</span>
<span class="n">config</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s2">&quot;file.ini&quot;</span><span class="p">)</span>
<span class="n">config</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;my_section&quot;</span><span class="p">,</span> <span class="s2">&quot;my_param&quot;</span><span class="p">,</span> <span class="s2">&quot;my_value&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;file.ini&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">config</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</pre></div>
<p>Here is a function designed to help you update ini files</p>
<div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">saveParam</span><span class="p">(</span><span class="n">pathToFile</span><span class="p">,</span> <span class="n">section</span><span class="p">,</span> <span class="n">param</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Save/add value to an ini file </span>
<span class="sd"> pathToFile : string, path to the ini file </span>
<span class="sd"> section : string, name of the section to write to</span>
<span class="sd"> param : string, name of the parameter to write the value to </span>
<span class="sd"> value : value to be written to the parameter</span>
<span class="sd"> If the file doesn&#39;t exist, it will be created</span>
<span class="sd"> If the section doesn&#39;t exist, it will be created</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">config</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="p">()</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">pathToFile</span><span class="p">):</span>
<span class="c1">#create the file if it does not exist</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">pathToFile</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="k">pass</span>
<span class="n">config</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">pathToFile</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">config</span><span class="o">.</span><span class="n">has_section</span><span class="p">(</span><span class="n">section</span><span class="p">):</span>
<span class="c1">#create the section if it does not exist</span>
<span class="n">config</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="n">section</span><span class="p">)</span>
<span class="n">config</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">section</span><span class="p">,</span> <span class="n">param</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">pathToFile</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="c1">#write value to the file</span>
<span class="n">config</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</pre></div>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -112,7 +112,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 92 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -5,7 +5,7 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>redoules.github.io/</loc>
<lastmod>2019-08-06T22:04:24-00:00</lastmod>
<lastmod>2019-08-14T21:39:48-00:00</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>
@ -17,6 +17,34 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/python/maximize_window.html</loc>
<lastmod>2019-08-12T11:31:00+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/python/iterate_dict.html</loc>
<lastmod>2019-08-09T11:40:00+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/python/case_config.html</loc>
<lastmod>2019-08-09T11:31:00+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/python/write_config_file.html</loc>
<lastmod>2019-08-09T11:17:00+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/python/Parula.html</loc>
<lastmod>2019-08-04T11:01:00+02:00</lastmod>

View File

@ -344,7 +344,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -631,7 +631,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -216,7 +216,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -346,7 +346,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -156,7 +156,7 @@ REVOKE ALL PRIVILEGES ON *.* FROM &#39;user&#39;@&#39;%&#39;
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -305,7 +305,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 88 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 93 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

File diff suppressed because one or more lines are too long