Python Forum

Full Version: Python loop problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Jun-17-2020, 07:49 PM)buran Wrote: [ -> ]
(Jun-17-2020, 07:25 PM)Kristenl2784 Wrote: [ -> ]Will I need to change the name = NNB-6a_v1_T01 Report manually so that it goes through all of the files?
it's in the loop - file variable is exactly that. you need to make transformations and get what you want the new name to be, then use it to create output_file variable used in save()

I'm not sure what you mean by this. Sorry super new to Python.
(Jun-18-2020, 03:52 PM)Kristenl2784 Wrote: [ -> ]I'm not sure what you mean by this. Sorry super new to Python.
starting from line 12 you have a for loop

for file in files:
you iterate over files and file is a variable that holds each file name as a string. So you can use file and change it as I show you and get new name and save the file. In next iteration of the loop it will hold next file name and so on...
Pages: 1 2