Thanks! Thats exactly what my problem was. I fixed it On Tue, Sep 9, 2014 at 12:57 PM, Alan Gauld <[email protected]> wrote:
> From: Felisha Lawrence <[email protected]> >> Date: Tue, Sep 9, 2014 at 8:53 AM >> Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory >> To: Danny Yoo <[email protected]> >> >> >> 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 - [email protected] > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) [email protected] (email)
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
