pythonpath

How to write the path in python to access a folder from windows desktop


C:\Users\jisha>cd \Desktop\ExerciseFiles\ --- this is the command i have given in command prompt in Windows. The system cannot find the path specified. ----this is the error message.

I want to access the ExerciseFiles folder in the desktop. How to get the path?

I tried to get a folder in my desktop and it is named as ExerciseFiles. Is anyone know how to get the path


Solution

  • If you are trying to reach a folder from a cmd then command would be:

    cd C:\Users\jisha\Desktop\ExerciseFiles
    

    If you are trying to run cmd command from python then it goes like this

    import os
    os.system('cd C:\Users\jisha\Desktop\ExerciseFiles')