From: Felisha Lawrence <felisha.lawre...@gmail.com>
Date: Tue, Sep 9, 2014 at 8:53 AM
Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory
To: Danny Yoo <d...@hashcollision.org>


Also,
I had this code working

import os

path = '/Users/felishalawrence/testswps/vol1'
for file in os.listdir(path):
         newFile = file[:file.index("v")]+"v20"

         print newFile
and now I am getting this error

ValueError: substring not found

I did not change anything

Have you checked that no new files have been created - possibly by your code, that don't conform to your expected naming style?

Try putting a 'print file' before the name modification to see what the name that causes the error looks like.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to