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,660 points
51 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
• 68,860 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
208 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
• 57,490 points
57 views
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
168 views
0 votes
2 answers

Indentation Error in Python

Use tabs instead of spaces. This is ...READ MORE

answered Feb 14, 2019 in Python by Shashank
• 1,350 points
136 views
0 votes
1 answer
+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 533 views
0 votes
0 answers
+4 votes
6 answers
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
• 68,860 points
2,441 views
0 votes
2 answers