Python Forum
Make the script read from any directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make the script read from any directory

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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Thanks a lot for your very nice explanation.

Possibly Related Threads…
Thread Author Replies Views Last Post
  python keeps opening script directory Tyrel 2 70 Yesterday, 08:37 PM
Last Post: Tyrel
  problem with sphinx and file directory in script kiyoshi7 0 479 Mar-11-2021, 03:52 PM
Last Post: kiyoshi7
  read the first line in my script chubbychub 1 438 Nov-09-2020, 03:18 AM
Last Post: Larz60+
  Python: Automated Script to Read Multiple Files in Respective Matrices Robotguy 7 1,451 Jul-03-2020, 01:34 AM
Last Post: bowlofred
  How to make the script ignore down devices. wagnergt12 4 1,012 Apr-20-2020, 11:45 PM
Last Post: wagnergt12
  How do I read the HTML files in a directory and write the content into a CSV file? glittergirl 1 858 Sep-23-2019, 11:01 AM
Last Post: Larz60+
  How can I make this Python script add a limit to trades made with API? streetlaw 0 1,006 Oct-12-2018, 11:41 AM
Last Post: streetlaw
  How can I make a python script create an EXE? ahmed_mokhles 26 5,819 Aug-31-2018, 12:38 PM
Last Post: ahmed_mokhles
  How to Make Python code execution pause and resume to create .csv and read values. Kashi 2 2,049 Jun-14-2018, 04:16 PM
Last Post: DeaD_EyE
  Script to read, write data to excel file and update it to firebase Expertlearner 1 2,164 Jan-03-2018, 03:32 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020