import os
def rename_files():
file_list = os.listdir(r"C:\Users\jsun0011\Downloads\prank")
print(file_list)
As I run the code, the output is supposed to display the files of the folder named "prank", yet nothings showing up. (in the pic)
import os
def rename_files():
file_list = os.listdir(r"C:\Users\jsun0011\Downloads\prank")
print(file_list)
As I run the code, the output is supposed to display the files of the folder named "prank", yet nothings showing up. (in the pic)
Your code seems to be fine and if you're not getting anything as output, there may be 2 cases:
prank folder doesn't contain anything, even in this case - It should've given empty list i.e.[]
you're not calling rename_files method anywhere (probably, this is your case), Kindly make a function call as defined below:
import os
def rename_files():
file_list = os.listdir(r"C:\Users\jsun0011\Downloads\prank")
print(file_list)
rename_files()