how to prepend string to a string?

newcoder justanbcoder at yahoo.com
Tue May 31 15:51:51 EDT 2005


How about this:

dirList = ['depth1', 'depth2', 'depth3']
string = """position"""

for x in range(len(dirList)):
	string += '>> %s' % dirList.pop(0)

print string



flamesrock wrote:
> Thanks for all the responses :)
>
> You're right, Kent. That does exactly what I need it to.
>
> Anyways.. if there isn't a prepend function, I'm going to request it
> from the devs. Would be cool to see that in future versions of python.




More information about the Python-list mailing list