[Tutor] Re: os module continued

Deirdre Saoirse deirdre@deirdre.net
Thu, 26 Oct 2000 12:16:02 -0700 (PDT)


On Thu, 26 Oct 2000, Dwain Hargrave wrote:

> >         s = "Added /fake/structure/log" + x
> 
> Didn't work... why?  Because it seemed to be treating x as a number

Ah, right, str(x)

(yesterday was a very long day on very little sleep)

>     s = "/fake/structure/log%d" % (x)  <-- this line solved my problem

Yes, you can also use %s (for numbers, there's no distinction and it
doesn't seem to be a performance hit)

-- 
_Deirdre   *   http://www.sfknit.org   *   http://www.deirdre.net
"You had thesaurus flakes for breakfast again, didn't you?"
                                                 -- Eric Williams