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,740 points
1,641 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,220 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
28,903 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,020 points
1,777 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 28, 2020 in Python by Gitika
• 65,770 points
4,160 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,840 points
775 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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,460 views
0 votes
1 answer
+5 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,790 points
4,115 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,220 points
13,761 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
42,644 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP