Article 6KX61 Error in python code.

Error in python code.

by
ajiten
from LinuxQuestions.org on (#6KX61)
Am getting weird error output, from the following code, in Python, on spyder:
Code:input_dir = "D:\Screenshots\bk\ch_1"
import os
path = os.chdir(input_dir)
i=0
for file in os.listdir(path):
print(file)Error:
Code:runfile('C:/Users/HP/untitled0.py', wdir='C:/Users/HP')
Traceback (most recent call last):

File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\users\hp\untitled0.py:9
path = os.chdir(input_dir)

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'D:\\Screenshots\x08k\\ch_1'
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments