[Tutor] os module continued

D-Man dsh8290@rit.edu
Thu, 26 Oct 2000 15:53:04 -0400


That's one solution.  
Another is to convert x to a string:

s = "Added /fake/structure/log" + `x`

or

s = "Added /fake/structure/log" + str( x )


The backquotes in the first example are a shortcut to call the str() funciton in the second example.

-D


On Thu, 26 Oct 2000 15:02:59 Dwain Hargrave wrote:
> >         s = "Added /fake/structure/log" + x
> 
> Didn't work... why?  Because it seemed to be treating x as a number
> 
>     s = "/fake/structure/log%d" % (x)  <-- this line solved my problem