flamesrock wrote: > so I know you can append a string. But how do you *prepend* a string, > as shown in the following code > > #dirList = ['depth1','depth2','depth3'] > #string = """position""" > #for x in len(dirList): > # string += '>> %s'%dirList.pop() #(????????????) > # > > to return > position>> depth1 >> depth2 >> depth3
ISTM the problem is not prepending, but getting the elements of dirList in the order you want. If you iterate over the list normally you get the desired result: dirList = ['depth1','depth2','depth3'] string = """position""" for x in dirList: string += '>> %s'% x Kent -- http://mail.python.org/mailman/listinfo/python-list