[Tutor] Fwd: Fwd: Re: Output 'Strings' to directory

Felisha Lawrence felisha.lawrence at gmail.com
Tue Sep 9 19:26:24 CEST 2014


Thanks! Thats exactly what my problem was. I fixed it

On Tue, Sep 9, 2014 at 12:57 PM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

> From: Felisha Lawrence <felisha.lawrence at gmail.com>
>> Date: Tue, Sep 9, 2014 at 8:53 AM
>> Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory
>> To: Danny Yoo <dyoo at 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 at python.org
> 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)
felisha.lawrence at gmail.com (email)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140909/a23ca097/attachment.html>


More information about the Tutor mailing list