Open (txt) editor and get its content
On 19/04/18 08:39, zljubisic at gmail.com wrote:
> I have a script that should accept sql query as a parameter and change it in a way. For now I have a file in which I have put sql query and than python script opens it and do everything else.
> Is it possible to run python script that will open editor and let me paste sql query in the editor, and than after closing editor, get editor's content in python script?
You already have the query in a file, so you can just use
subprocess.run() to start your favourite editor and wait until it exits,
then *check the return code* (if you don't, you will wish you had) and
read the file back.
> Is there any other option for getting interactive multi line input from user.
input() and patience :-)
Rhodri James *-* Kynesim Ltd