greenflame wrote: > I want to make a function that does the following. I will call it > thefunc for short. > > >>> s = "Char" > >>> thefunc(s) > >>> s > '||Char>>' > > I tried the following > > def thefunc(s): > s = "||" + s + ">>" > > The problem is that if I look at the string after I apply the function > to it, it is not modified. I realized that I am having issues with the > scope of the variables. The string in the function, s, is local to the > function and thus I am not changing the string that was inputed, but a > copy. I cannot seem to figure out how to get what I want done. Thank > you for your time.
quick hack def thefunc(s): return s = "||" + s + ">>" >>> s = "hello" >>> s = thefunc(s) >>> print s ||hello>> --Cheers -- http://mail.python.org/mailman/listinfo/python-list