I got the following code :
import readline from colorama import Fore, Style def prompt(): print(Fore.RED + 'prompt' + Style.RESET_ALL + '> ', end='', flush=True) readline.set_pre_input_hook(prompt) # Read input lines from stdin, preserving history while True: line = input() print(line) readline.add_history(line)
When I press up and down key to browse history, the prompt disappear. Is it fixable ?
submitted by /u/Stunning-Mix492
[link] [comments]
r/learnpython I got the following code : import readline from colorama import Fore, Style def prompt(): print(Fore.RED + ‘prompt’ + Style.RESET_ALL + ‘> ‘, end=”, flush=True) readline.set_pre_input_hook(prompt) # Read input lines from stdin, preserving history while True: line = input() print(line) readline.add_history(line) When I press up and down key to browse history, the prompt disappear. Is it fixable ? submitted by /u/Stunning-Mix492 [link] [comments]
I got the following code :
import readline from colorama import Fore, Style def prompt(): print(Fore.RED + 'prompt' + Style.RESET_ALL + '> ', end='', flush=True) readline.set_pre_input_hook(prompt) # Read input lines from stdin, preserving history while True: line = input() print(line) readline.add_history(line)
When I press up and down key to browse history, the prompt disappear. Is it fixable ?
submitted by /u/Stunning-Mix492
[link] [comments]