Sick Gaming
[Tut] How to Create Your Own Search Engine in a Single Line of Python? - Printable Version

+- Sick Gaming (https://sickgaming.net)
+-- Forum: Programming (https://sickgaming.net/forum-76.html)
+--- Forum: Python (https://sickgaming.net/forum-83.html)
+--- Thread: [Tut] How to Create Your Own Search Engine in a Single Line of Python? (/thread-94414.html)



[Tut] How to Create Your Own Search Engine in a Single Line of Python? - xSicKxBot - 04-06-2020

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

This Python One-Liner is part of myPython One-Liners bookwith NoStarch Press.



Here’s the code from the video:

Code:
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'))

Try It Yourself:

https://repl.it/@finxter/PythonOneLinerSearchEngine?lite=true

Related Articles: