16 lines
316 B
Python
16 lines
316 B
Python
|
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
|