diff --git a/python/user_input_nano.py b/python/user_input_nano.py new file mode 100644 index 0000000..8ec9bb6 --- /dev/null +++ b/python/user_input_nano.py @@ -0,0 +1,15 @@ +from pathlib import Path +import tempfile +import subprocess + +def input_nano() -> str: + f = tempfile.NamedTemporaryFile(mode='w+t', delete=False) + n = f.name + f.close() + subprocess.call(['nano', n]) + + with open(n, 'r') as f: + input_string = f.read() + Path(n).unlink() + + return input_string