Change one list item in place

Gnarlodious gnarlodious at gmail.com
Tue Nov 30 20:08:57 EST 2010


This works for me:

def sendList():
    return ["item0", "item1"]

def query():
    l=sendList()
    return ["Formatting only {0} into a string".format(l[0]), l[1]]

query()


However, is there a way to bypass the

l=sendList()

and change one list item in-place? Possibly a list comprehension
operating on a numbered item?

-- Gnarlie



More information about the Python-list mailing list