Python change directory error

–1 vote

I am trying to change directory in python and am getting an error message:

import os
os.chdir(path=\Users\edenk\)
print(os.getcwd())
File "<ipython-input-1-7efd99e461e0>", line 2
    os.chdir(path=\Users\edenk\)
                                ^
SyntaxError: unexpected character after line continuation character
Jan 8, 2019 in Python by digger
• 26,700 points
381 views

1 answer to this question.

0 votes

The syntax of the command you are using to change the directory is wrong. 

To change the directory, follow the below syntax:

os.chdir("/path/to/change/to")
answered Jan 8, 2019 by Omkar
• 69,110 points

Related Questions In Python

+2 votes
6 answers

How can I change directory or "cd" in Python?

Context Manager: cd import os class cd:     """Context manager for ...READ MORE

answered Oct 18, 2018 in Python by Nabarupa
9,988 views
0 votes
1 answer

Know/change current directory in Python shell?

This will work  >>> import os >>> os.getcwd() '/home/user' >>> os.chdir("/tmp/") >>> ...READ MORE

answered Nov 12, 2018 in Python by Priyaj
• 58,100 points
609 views
0 votes
1 answer

fatal error: Python.h: No such file or directory

On Ubuntu, I was running Python 3 ...READ MORE

answered Nov 27, 2020 in Python by Gitika
• 65,870 points
1,019 views
0 votes
1 answer

How do I change the working directory in Python?

Hello @kartik, use os.chdir like this: os.chdir("/path/to/change/to") By the way, if you ...READ MORE

answered Dec 8, 2020 in Python by Niroj
• 82,680 points
61 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,977 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,511 views
0 votes
1 answer

Python argparse error "NameError: name 'file' is not defined"

The right datatype for destination in argpasrse module ...READ MORE

answered Nov 28, 2018 in Python by Omkar
• 69,110 points
7,629 views
0 votes
3 answers

Python error "NameError: name 'sr' is not defined"

NameError: name 'xx' is not defined Python knows ...READ MORE

answered Mar 19, 2020 in Python by rahul
• 360 points
32,700 views