Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
listdir trouble
#1
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
Reply
#2
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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  listdir on IP Adress OEMS1 3 2,877 Jul-19-2020, 06:01 PM
Last Post: bowlofred
  trouble with os.listdir on a network drive lconner 10 19,034 Jun-04-2019, 07:16 PM
Last Post: DeaD_EyE
  os.listdir(path) and non-string as input metalray 4 16,624 Aug-15-2018, 11:43 AM
Last Post: metalray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020