Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialangel moreta
Courses Plus Student 291 Pointsimport os i need some help here
1 import os 2 print(os.getcwd()) # stand for get current work directory 3 os.chdir('/Users/angelmoreta/Desktop/') #chdir stand for change directory 4 print(os.listdir())
I Dont know why am i getting a TypeError that says listdir() takes exactly 1 argument ??? am i doing something wrong ?
1 Answer
Bapi Roy
14,237 PointsIt is because you are not giving path information to os.listdir(path). Where path = This is the directory, which needs to be explored.
nakalkucing
12,964 Pointsnakalkucing
12,964 PointsYour code would be easier to read if you wrote it in proper syntax. Take a look at the Markdown Cheatsheet to learn how to do this. Hope this helps. :)