Python Forum
listdir trouble - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: listdir trouble (/thread-7610.html)



listdir trouble - Dixon - Jan-17-2018

import os
def rename_files():
    list = os.listdir(r'C\Users\Public\Tyrell\Tyrrell')
    print (list)

I get nothing to print from this. Using version 3.6.4. It works for the guy on Udacity, but he's using 2.7. Any help appreciated; maybe I'm too old to learn this stuff Cry


RE: listdir trouble - micseydel - Jan-17-2018

Are you calling the function? The code you've shown defines the function, but doesn't call it. You'd have to add a line at the bottom
rename_files()