Python Forum

Full Version: Make the script read from any directory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

How could I make the script read the data from any directory,

I'd like to make it something like this,

product_path = os.path.join('product_path')
user_input_dir = input('\nPlease enter your directory path\n' + product_path)

It doesn't work,

Any suggestions please!
this line is not doing anything
product_path = os.path.join('product_path')
this line will not produce the full path
user_input_dir = input('\nPlease enter your directory path\n' + product_path)
you want
user_input_dir = input('\nPlease enter your directory path\n')
product_path = os.path.join('product_path', user_input_dir) # assuming 'product path' is real dir
Thanks a lot for your very nice explanation.