I am trying to learn about Python and in the online class they suggest I run this code:
import os
def rename_files():
#(1) get file names from a folder
file_list = os.listdir(r"C:\Users\steph\Desktop\prank")
print(file_list)
#(2) for each file, rename filename
In order to print all the items in a folder. However, it doesn't do anything for me. In the shell all that appears is:
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
======== RESTART: C:\Users\steph\OneDrive\PythonClass\renamefiles.py ========
>>>
Do you know why? In a previous lesson a similar thing happend: they provided code that would open a web browser - and it worked - but only once! Afterwards the same "RESTART: ..." line would appear and nothing more.
The keywords (at least those that are available to me) are so generic, I cannot find it. I am just starting out with Python and would love to make some progress.