Jan-29-2020, 02:44 PM
all of the examples I have provided would do. Obviously the os.path functions will require less change in your code.
(Jan-29-2020, 02:28 PM)ovidius Wrote: something that works with string formatting inside the .format(filename)you can construct the new file name in the open function using os.path functions, but for sake of readability it's better to do it on separate line, e.g. replace line 26
for line in open(('{}_clean.csv').format(filename),'r'):with
new_name = ''.join((os.path.splitext(filename)[0], '_clean.csv')) for line in open(new_name, 'r'):
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs