Python Forum
Using python for text replacement - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Using python for text replacement (/thread-1299.html)



Using python for text replacement - omar - Dec-22-2016

I want to make many ready made text be available.

So if I type #hello for example, I could have this replaced with one line or many paragraphs of text.

Is there code or libraries that will help me with this?

I use Autohotkey right now - this work OK - and I can do everything I need.
But, I needed a few extras, so I thought I might try to code in Python for that.
Like for example, I wanted a nice GUI interface where the user can use to create and edit text shortcuts.

Thanks.


RE: Using python for text replacement - ichabod801 - Dec-22-2016

You don't need a library to do the replacement. The replace method of strings is probably all you need. Although, if you wanted to get fancy you could use the re regular expression module. But you don't need that just to replace #hello.

There are lots of GUI packages out there for Python: Tkinter, PyQt, wxPython, and more.