Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] How to Create Your Own Search Engine in a Single Line of Python?

#1
How to Create Your Own Search Engine in a Single Line of Python?

<div><p>This Python One-Liner is part of my<a href="https://www.amazon.com/gp/product/B07ZY7XMX8" target="_blank" rel="noreferrer noopener"> Python One-Liners book </a>with NoStarch Press.</p>
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio">
<div class="wp-block-embed__wrapper">
<div class="ast-oembed-container"><iframe title="Python One-Liners - Trick 4 - How to Create Your Own Little Search Engine in One Line?" width="1400" height="788" src="https://www.youtube.com/embed/5egoqwCACkY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div>
</figure>
<p>Here’s the code from the video:</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="">letters_amazon = '''
We spent several years building our own database engine,
Amazon Aurora, a fully-managed MySQL and PostgreSQL-compatible
service with the same or better durability and availability as
the commercial engines, but at one-tenth of the cost. We were
not surprised when this worked. ''' find = lambda x, q: x[x.find(q)-18:x.find(q)+18] if q in x else -1 print(find(letters_amazon, 'SQL'))
</pre>
<p>Try It Yourself:</p>
<p> <iframe height="600px" width="100%" src="https://repl.it/@finxter/PythonOneLinerSearchEngine?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe> </p>
<p>Related Articles:</p>
<ul>
<li><a href="https://blog.finxter.com/introduction-to-slicing-in-python/" target="_blank" rel="noreferrer noopener">Python Slicing</a></li>
<li><a href="https://blog.finxter.com/if-then-else-in-one-line-python/" target="_blank" rel="noreferrer noopener">Ternary Operator in Python</a></li>
<li><a href="https://blog.finxter.com/a-simple-introduction-of-the-lambda-function-in-python/">Lambda Function</a></li>
<li><a href="https://blog.finxter.com/python-re-findall/" target="_blank" rel="noreferrer noopener">Find Function</a></li>
</ul>
</div>


https://www.sickgaming.net/blog/2020/04/...of-python/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tut] Check Python Version from Command Line and in Script xSicKxBot 0 884 08-24-2023, 01:34 PM
Last Post: xSicKxBot
  [Tut] I Used These 3 Easy Steps to Create a Bitcoin Wallet in Python (Public/Private) xSicKxBot 0 593 01-29-2023, 02:51 AM
Last Post: xSicKxBot
  [Tut] The Hidden Gems: 4 Best Google Search Libraries for Python You Can’t Miss! xSicKxBot 0 637 12-21-2022, 07:12 AM
Last Post: xSicKxBot
  [Tut] How to Create and Run a Batch File That Runs a Python Script? xSicKxBot 0 613 11-09-2022, 09:53 PM
Last Post: xSicKxBot
  [Tut] Python Create JSON File xSicKxBot 0 638 11-03-2022, 01:09 PM
Last Post: xSicKxBot
  [Tut] How to Retrieve a Single Element from a Python Generator xSicKxBot 0 585 09-30-2022, 11:20 AM
Last Post: xSicKxBot
  [Tut] How to Delete a Line from a File in Python? xSicKxBot 0 609 09-24-2022, 10:31 AM
Last Post: xSicKxBot
  [Tut] How to Create a Python Tuple of Size n? xSicKxBot 0 585 08-26-2022, 10:02 AM
Last Post: xSicKxBot
  [Tut] A Simple Guide for Using Command Line Arguments in Python xSicKxBot 0 546 08-14-2022, 05:49 PM
Last Post: xSicKxBot
  [Tut] How to Convert Multiple Text Files to a Single CSV in Python? xSicKxBot 0 615 08-05-2022, 06:41 PM
Last Post: xSicKxBot

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016