[SciPy-user] help with list comprehensions
Stephen Yang
scyang at nist.gov
Wed Aug 1 14:49:58 EDT 2007
Hello everyone,
I have a question about list comprehensions. I would like to append data
to an existing list using a list comprehension. Unfortunately, what I
have tried does not seem to work:
>>> y = [5, 1, 3, 5]
>>> x = ['a', 'b']
>>> new = [x.append(data) for data in y]
>>> new
[None, None, None, None]
Can anyone help? Thanks very much in advance.
Stephen
More information about the SciPy-User
mailing list