Hitesh a écrit : > On Mar 18, 12:28 am, "Hitesh" <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I've a list like this.. >> str1 = ['this is a test string inside list'] >> >> I am doing it this way. >> >> for s in str1: >> temp_s = s >> print temp_s
Why this useless temp_s var ? >> >> Any better suggestions? >> >> Thank you, >> hj > > I want to cast value of a list into string.. > There's no "cast" in Python. It would make no sens in a dynamically typed language, where type informations belong to the LHS of a binding, not the RHS. I guess that what you want is to build a string out of a list of strings. If so, the answer is (assuming you want a newline between each element of the list): print "\n".join(str1) -- http://mail.python.org/mailman/listinfo/python-list