Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
>                          quotechar="'", delimiter='\t')
> for line in reader:
>     if cnt > 6:
>        break
>     for col in line:
>        p[:0].append(str(col))

What are you trying to do here?  p[:0]  returns a new list, of all the
elements in p up to element 0 (which is of course the empty list),
which is then appended to, but is not stored anywhere.  If you want to
insert str(col) then use p.insert


Iain

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to