<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I expected the following code to work: > > f = file(fn,"wb") > writer = csv.writer(f) > for i in range(IMax): > writer.writerow([dates[i]].append([ReturnHistories[j][i] for j in > range(N)])) > > but instead i got the following error message: > Error: sequence expected >
Probably because append returns None, not the list you just appended to. Also, it appears that your append statement is not doing what you want, appending to [dates[i]] (that is, a temporary list containing a single element, the list that is the i'th element of dates), when your "working" example appends directly to dates[i]. Sometimes (usually?) an explicit body of 2 or 3 statements is better than trying to cram everything into a one-liner... -- Paul -- http://mail.python.org/mailman/listinfo/python-list