12-07-2022, 06:41 AM
Python | Split String Variable Spaces
<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{"align":"left","id":"957593","slug":"default","valign":"top","ignore":"","reference":"auto","class":"","count":"0","legendonly":"","readonly":"","score":"0","best":"5","gap":"5","greet":"Rate this post","legend":"0\/5 - (0 votes)","size":"24","width":"0","_legend":"{score}\/{best} - ({count} {votes})","font_factor":"1.25"}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 0px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> <span class="kksr-muted">Rate this post</span> </div>
</div>
<p class="has-background" style="background-color:#d1a9fa"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2b50.png" alt="⭐" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Summary:</strong> The most efficient way to split a string using variable spaces is to use the <code>split</code> function like so <code>given_string.split()</code>. An alternate approach is to use different functions of the regex package to split the string at multiple whitespaces.</p>
<h3><strong>Minimal Example</strong></h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">text = "a b c d"
# Method 1
print(text.split())
# Method 2
import re
print(re.split('\s+', text))
# Method 3
print([x for x in re.findall(r'\S+', text) if x != ''])
# Method 4
print(re.sub(r'\s+', ',', text).split(','))
# Method 5
print(list(filter(None, text.split()))) # ['a', 'b', 'c', 'd']</pre>
<h2><strong>Problem Formulation</strong></h2>
<p class="has-global-color-8-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4dc.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Problem:</strong> Given a string. How will you split the string using multiple spaces?</p>
<h3><strong>Example</strong></h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Input
text = "abc xyz lmn pqr"
# Output
['abc', 'xyz', 'lmn', 'pqr']</pre>
<p>The given input has multiple spaces between each substring, i.e., there are three spaces after <code>abc</code>, two spaces after <code>xyz</code> while a single space after <code>lmn</code>. So, not only do you have multiple spaces between the substring but also varied number of spaces. Can you split the string by varied and multiple spaces?</p>
<hr class="wp-block-separator has-alpha-channel-opacity" />
<p>Though the question might look daunting at first but once you get hold of it, the solutions to this problem are easier than one can imagine. So, without further delay let us dive into the different ways of solving the given problem.</p>
<h2>Method 1: Using <a rel="noreferrer noopener" href="https://blog.finxter.com/python-string-split/" target="_blank">split()</a></h2>
<p>The built-in <code>split('sep')</code> function allows you to split a string in Python based on a given delimiter. By default the <code>split</code> function splits a given string at whitespaces. Meaning, if you do not pass any delimiter to the split function then the string will be split at whitespaces. </p>
<p>You can use this default property of the split function and successfully split the given string at multiple spaces just by using the <code>split()</code> function.</p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">text = "abc xyz lmn pqr"
print(text.split()) # ['abc', 'xyz', 'lmn', 'pqr']</pre>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Recommended Digest</strong>: <strong><a href="https://blog.finxter.com/python-string-split/">Python String split()</a></strong></p>
<h2>Method 2: <strong>Using re.split</strong></h2>
<p>The <code>re.split(pattern, string)</code> method matches all occurrences of the <code>pattern</code> in the <code>string</code> and divides the string along the matches resulting in a list of strings <em>between </em>the matches. For example, <code>re.split('a', 'bbabbbab')</code> results in the list of strings <code>['bb', 'bbb', 'b']</code>.</p>
<p><strong>Approach: </strong>To split the string using multiple space characters use <code>re.split("\s+", text)</code> where <code>\s+</code> is the matching pattern and it represents a special sequence that returns a match whenever it finds any whitespace character and splits the string. So, whenever there’s a space or multiple spaces (any number of occurrences of space are whitespace characters) the string will be split. </p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import re
text = "abc xyz lmn pqr"
print(re.split('\s+', text))
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Recommended Read: <strong><a rel="noreferrer noopener" href="https://blog.finxter.com/python-regex-split/" target="_blank">Python Regex Split</a></strong>.</strong></p>
<h2><strong>Method 3</strong>: Using re.findall</h2>
<p>The <code>re.findall(pattern, string)</code> method scans the <code>string</code> from <strong>left to right</strong>, searching for all <strong>non-overlapping matches</strong> of the <code>pattern</code>. It returns a <strong>list of strings</strong> in the matching order when scanning the string from left to right.</p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Recommended Read: <a rel="noreferrer noopener" href="https://blog.finxter.com/python-re-findall/" target="_blank">Python re.findall() – Everything You Need to Know</a></strong></p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import re
text = "abc xyz lmn pqr"
print([x for x in re.findall(r'\S+', text) if x != ''])
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<h2><strong>Method 4: Using <a href="https://blog.finxter.com/python-regex-sub/" target="_blank" rel="noreferrer noopener">re.sub</a></strong></h2>
<p>The regex function <code>re.sub(P, R, S)</code> replaces all occurrences of the pattern <code>P</code> with the replacement <code>R</code> in string <code>S</code>. It returns a new string. For example, if you call <code>re.sub('a', 'b', 'aabb')</code>, the result will be the new string <code>'bbbb'</code> with all characters <code>'a'</code> replaced by <code>'b'</code>.</p>
<p><strong>Approach: </strong>Use the <code>re.sub</code> method to replace all occurrences of space characters in the given string with a comma. Thus, the string will now have commas instead of space characters and you can simply split it using a normal string split method by passing comma as the delimiter. </p>
<p>Silly! Isn’t it? Nevertheless, it works. </p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import re
text = "abc xyz lmn pqr"
res = re.sub(r'\s+', ',', text).split(',')
print(res)
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<h2>Method 5: Using filter</h2>
<p>Python’s built-in <code>filter()</code> function filters out the elements that pass a filtering condition. It takes two arguments: function and iterable. The function assigns a Boolean value to each element in the iterable to check whether the element will pass the filter or not. It returns an iterator with the elements that pass the filtering condition.</p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Related Read: </strong><a href="https://blog.finxter.com/python-filter/"><strong>Python filter()</strong></a></p>
<p><strong>Approach: </strong>You can use the <code>filter()</code> method to split the string by space. Feed in <code>None</code> as the first argument and the list of split strings as the second argument into the <code>filter</code> function. The <code>filter()</code> function then iterates through the list and filters out the spaces from the given string and returns only the non-whitespace characters. As the <code>filter()</code> method returns an object, we need to use the <code>list()</code> to convert the object into a list.</p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">text = "abc xyz lmn pqr"
print(list(filter(None, text.split())))
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<h2>Conclusion</h2>
<p>Hurrah! We have successfully solved the given problem using as many as five different ways. I hope you enjoyed reading this <a href="https://blog.finxter.com/"><strong>article</strong></a> and it helped you in your Python coding journey. Please <a href="https://blog.finxter.com/subscribe/"><strong>subscribe and stay tuned</strong></a> for more interesting articles! </p>
<p>Happy coding! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Suggested Read: <a href="https://blog.finxter.com/python-regex/" target="_blank" rel="noreferrer noopener">Python Regex Superpower [Full Tutorial]</a></strong></p>
<hr class="wp-block-separator has-alpha-channel-opacity" />
<p><strong><em>Do you want to master the regex superpower?</em></strong> Check out my new book <em><strong><a href="https://blog.finxter.com/ebook-the-smartest-way-to-learn-python-regex/" target="_blank" rel="noreferrer noopener" title="[eBook] The Smartest Way to Learn Python Regex">The Smartest Way to Learn Regular Expressions in Python</a></strong></em> with the innovative 3-step approach for active learning: (1) study a book chapter, (2) solve a code puzzle, and (3) watch an educational chapter video. </p>
</div>
https://www.sickgaming.net/blog/2022/12/...le-spaces/
<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{"align":"left","id":"957593","slug":"default","valign":"top","ignore":"","reference":"auto","class":"","count":"0","legendonly":"","readonly":"","score":"0","best":"5","gap":"5","greet":"Rate this post","legend":"0\/5 - (0 votes)","size":"24","width":"0","_legend":"{score}\/{best} - ({count} {votes})","font_factor":"1.25"}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 0px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> <span class="kksr-muted">Rate this post</span> </div>
</div>
<p class="has-background" style="background-color:#d1a9fa"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2b50.png" alt="⭐" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Summary:</strong> The most efficient way to split a string using variable spaces is to use the <code>split</code> function like so <code>given_string.split()</code>. An alternate approach is to use different functions of the regex package to split the string at multiple whitespaces.</p>
<h3><strong>Minimal Example</strong></h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">text = "a b c d"
# Method 1
print(text.split())
# Method 2
import re
print(re.split('\s+', text))
# Method 3
print([x for x in re.findall(r'\S+', text) if x != ''])
# Method 4
print(re.sub(r'\s+', ',', text).split(','))
# Method 5
print(list(filter(None, text.split()))) # ['a', 'b', 'c', 'd']</pre>
<h2><strong>Problem Formulation</strong></h2>
<p class="has-global-color-8-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4dc.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Problem:</strong> Given a string. How will you split the string using multiple spaces?</p>
<h3><strong>Example</strong></h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Input
text = "abc xyz lmn pqr"
# Output
['abc', 'xyz', 'lmn', 'pqr']</pre>
<p>The given input has multiple spaces between each substring, i.e., there are three spaces after <code>abc</code>, two spaces after <code>xyz</code> while a single space after <code>lmn</code>. So, not only do you have multiple spaces between the substring but also varied number of spaces. Can you split the string by varied and multiple spaces?</p>
<hr class="wp-block-separator has-alpha-channel-opacity" />
<p>Though the question might look daunting at first but once you get hold of it, the solutions to this problem are easier than one can imagine. So, without further delay let us dive into the different ways of solving the given problem.</p>
<h2>Method 1: Using <a rel="noreferrer noopener" href="https://blog.finxter.com/python-string-split/" target="_blank">split()</a></h2>
<p>The built-in <code>split('sep')</code> function allows you to split a string in Python based on a given delimiter. By default the <code>split</code> function splits a given string at whitespaces. Meaning, if you do not pass any delimiter to the split function then the string will be split at whitespaces. </p>
<p>You can use this default property of the split function and successfully split the given string at multiple spaces just by using the <code>split()</code> function.</p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">text = "abc xyz lmn pqr"
print(text.split()) # ['abc', 'xyz', 'lmn', 'pqr']</pre>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Recommended Digest</strong>: <strong><a href="https://blog.finxter.com/python-string-split/">Python String split()</a></strong></p>
<h2>Method 2: <strong>Using re.split</strong></h2>
<p>The <code>re.split(pattern, string)</code> method matches all occurrences of the <code>pattern</code> in the <code>string</code> and divides the string along the matches resulting in a list of strings <em>between </em>the matches. For example, <code>re.split('a', 'bbabbbab')</code> results in the list of strings <code>['bb', 'bbb', 'b']</code>.</p>
<p><strong>Approach: </strong>To split the string using multiple space characters use <code>re.split("\s+", text)</code> where <code>\s+</code> is the matching pattern and it represents a special sequence that returns a match whenever it finds any whitespace character and splits the string. So, whenever there’s a space or multiple spaces (any number of occurrences of space are whitespace characters) the string will be split. </p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import re
text = "abc xyz lmn pqr"
print(re.split('\s+', text))
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Recommended Read: <strong><a rel="noreferrer noopener" href="https://blog.finxter.com/python-regex-split/" target="_blank">Python Regex Split</a></strong>.</strong></p>
<h2><strong>Method 3</strong>: Using re.findall</h2>
<p>The <code>re.findall(pattern, string)</code> method scans the <code>string</code> from <strong>left to right</strong>, searching for all <strong>non-overlapping matches</strong> of the <code>pattern</code>. It returns a <strong>list of strings</strong> in the matching order when scanning the string from left to right.</p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Recommended Read: <a rel="noreferrer noopener" href="https://blog.finxter.com/python-re-findall/" target="_blank">Python re.findall() – Everything You Need to Know</a></strong></p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import re
text = "abc xyz lmn pqr"
print([x for x in re.findall(r'\S+', text) if x != ''])
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<h2><strong>Method 4: Using <a href="https://blog.finxter.com/python-regex-sub/" target="_blank" rel="noreferrer noopener">re.sub</a></strong></h2>
<p>The regex function <code>re.sub(P, R, S)</code> replaces all occurrences of the pattern <code>P</code> with the replacement <code>R</code> in string <code>S</code>. It returns a new string. For example, if you call <code>re.sub('a', 'b', 'aabb')</code>, the result will be the new string <code>'bbbb'</code> with all characters <code>'a'</code> replaced by <code>'b'</code>.</p>
<p><strong>Approach: </strong>Use the <code>re.sub</code> method to replace all occurrences of space characters in the given string with a comma. Thus, the string will now have commas instead of space characters and you can simply split it using a normal string split method by passing comma as the delimiter. </p>
<p>Silly! Isn’t it? Nevertheless, it works. </p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import re
text = "abc xyz lmn pqr"
res = re.sub(r'\s+', ',', text).split(',')
print(res)
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<h2>Method 5: Using filter</h2>
<p>Python’s built-in <code>filter()</code> function filters out the elements that pass a filtering condition. It takes two arguments: function and iterable. The function assigns a Boolean value to each element in the iterable to check whether the element will pass the filter or not. It returns an iterator with the elements that pass the filtering condition.</p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Related Read: </strong><a href="https://blog.finxter.com/python-filter/"><strong>Python filter()</strong></a></p>
<p><strong>Approach: </strong>You can use the <code>filter()</code> method to split the string by space. Feed in <code>None</code> as the first argument and the list of split strings as the second argument into the <code>filter</code> function. The <code>filter()</code> function then iterates through the list and filters out the spaces from the given string and returns only the non-whitespace characters. As the <code>filter()</code> method returns an object, we need to use the <code>list()</code> to convert the object into a list.</p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">text = "abc xyz lmn pqr"
print(list(filter(None, text.split())))
# ['abc', 'xyz', 'lmn', 'pqr']</pre>
<h2>Conclusion</h2>
<p>Hurrah! We have successfully solved the given problem using as many as five different ways. I hope you enjoyed reading this <a href="https://blog.finxter.com/"><strong>article</strong></a> and it helped you in your Python coding journey. Please <a href="https://blog.finxter.com/subscribe/"><strong>subscribe and stay tuned</strong></a> for more interesting articles! </p>
<p>Happy coding! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4da.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong>Suggested Read: <a href="https://blog.finxter.com/python-regex/" target="_blank" rel="noreferrer noopener">Python Regex Superpower [Full Tutorial]</a></strong></p>
<hr class="wp-block-separator has-alpha-channel-opacity" />
<p><strong><em>Do you want to master the regex superpower?</em></strong> Check out my new book <em><strong><a href="https://blog.finxter.com/ebook-the-smartest-way-to-learn-python-regex/" target="_blank" rel="noreferrer noopener" title="[eBook] The Smartest Way to Learn Python Regex">The Smartest Way to Learn Regular Expressions in Python</a></strong></em> with the innovative 3-step approach for active learning: (1) study a book chapter, (2) solve a code puzzle, and (3) watch an educational chapter video. </p>
</div>
https://www.sickgaming.net/blog/2022/12/...le-spaces/