diff options
Diffstat (limited to 'examples/prompts/get-input-with-default.py')
-rwxr-xr-x | examples/prompts/get-input-with-default.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/prompts/get-input-with-default.py b/examples/prompts/get-input-with-default.py index 67446d5..974888f 100755 --- a/examples/prompts/get-input-with-default.py +++ b/examples/prompts/get-input-with-default.py @@ -3,10 +3,11 @@ Example of a call to `prompt` with a default value. The input is pre-filled, but the user can still edit the default. """ + import getpass from prompt_toolkit import prompt if __name__ == "__main__": - answer = prompt("What is your name: ", default="%s" % getpass.getuser()) - print("You said: %s" % answer) + answer = prompt("What is your name: ", default=f"{getpass.getuser()}") + print(f"You said: {answer}") |