On Tue, May 10, 2011 at 8:17 AM, Tommy Bell <to...@enkelthed.dk> wrote: > scandir('c:\tmp')
> this doesnt work, I know why - but i dont know how to fix it. > The reason it doesnt work is because isfile requires a file, but current > contains a path. Not quite. Stick a "print path" as the first line in scandir. Notice that it doesn't print out c:\tmp The issue is that Windows (Well, DOS, back in the day) decided to use backslashes as the path separator, where the rest of the world (mostly) used slashes. This meant that most programming languages use backslashes to "escape" characters to have special meaning. Putting "\n" in a string puts in not an "n" but a newline character. \t is a tab. This causes you (and many other windows programmers) a little bit of distress today, in many programming languages. To have your string recognize that your backslash is an actual real backslash you can escape it: scandir('c:\\tmp') After that your code should work fine (it runs on my system, but I'm not on windows). This filepath issue has many details you can look up or ask about, but this should get you started. -- Brett Ritter / SwiftOne swift...@swiftone.org _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor