Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
e1morganUCSD committed Dec 6, 2024
1 parent 84f354a commit 4314816
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions _sources/materials/18-WrapUp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,9 @@
},
"outputs": [],
"source": [
"# can just search for a letter\n",
"re.findall('o', my_string)"
"# can just search for a letter - note that the 'r' in front of the string \n",
"# changes it to a \"raw string literal\", needed to avoid complaints by re when using backslashes\n",
"re.findall(r'o', my_string)"
]
},
{
Expand All @@ -581,7 +582,7 @@
"outputs": [],
"source": [
"# but the patterns are where these shine\n",
"re.findall('\\d\\d', my_string)"
"re.findall(r'\\d\\d', my_string)"
]
},
{
Expand Down
7 changes: 4 additions & 3 deletions materials/18-WrapUp.html
Original file line number Diff line number Diff line change
Expand Up @@ -746,16 +746,17 @@ <h2>Regular Expressions<a class="headerlink" href="#regular-expressions" title="
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># can just search for a letter</span>
<span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s1">&#39;o&#39;</span><span class="p">,</span> <span class="n">my_string</span><span class="p">)</span>
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># can just search for a letter - note that the &#39;r&#39; in front of the string </span>
<span class="c1"># changes it to a &quot;raw string literal&quot;, needed to avoid complaints by re when using backslashes</span>
<span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;o&#39;</span><span class="p">,</span> <span class="n">my_string</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># but the patterns are where these shine</span>
<span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s1">&#39;\d\d&#39;</span><span class="p">,</span> <span class="n">my_string</span><span class="p">)</span>
<span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;\d\d&#39;</span><span class="p">,</span> <span class="n">my_string</span><span class="p">)</span>
</pre></div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 4314816

Please sign in to comment.