On Feb 21, 2020, at 05:54, minecraft2048@gmail.com wrote:

lUnfortunately when I try to type s"select * from table" it gave me syntax error instead, so I think this need to be implemented in Python language itself instead of module

Well, it can be implemented with a module if your module installs an import hook.

Unfortunately, the boilerplate to write an import hook is more complicated than you’d like (and pretty hard to figure out the first time), and the support for filtering on the token stream (the most obvious way to do this one) rather than the text stream, AST, or bytecode is pretty minimal and clumsy. It may be worth trying to teach yourself anyway, because you learn a lot about Python along the way, but I don’t know that the result is something you’d actually want to use (See https://github.com/abarnert/floatliteralhack for hints; I think that’s the shortest—although definitely not cleanest—way to install a token-filtering import hook for Python 3.4, and only a few things have changed since then.)