I have made a python script that asks the user to enter 2 or 3 filenames, which should be analysed. The filename insertion is done in the script (it is not passed as argument to argparse
, because there are other choices that user has to make before that). Due to the company naming convention these filenames can be quite long and thus cumbersome to type. To help the user I am printing the contents of directory. For now I am using something like this:
fname = raw_input("Insert phase 1 filename: ")
(than I check the if file exists etc...)
Is there a way to implement autocomplete for filenames inside the python script by writing custom input() function?
Note that the script must run on different machines / OS and I can not ask users to install some non-standard python libraries.
If there is no clean way to do it I might use less fancy solution of just printing a number before the filenames in the directory and than ask the user to insert just the number.