Scott David Daniels wrote:
> 
>     def lagged(source):
>         '''produce element,islast for elements in source'''
>         generator = iter(source)
>         previous = generator.next()
>         for element in generator:
>             yield previous, False
>         yield previous, True

Oops:
      def lagged(source):
          '''produce element,islast for elements in source'''
          generator = iter(source)
          previous = generator.next()
          for element in generator:
              yield previous, False
              previous = element
          yield previous, True

> 
>     file = open ('C:\some.csv','r')
>     reader = csv.reader(file)
>     for row, final in lagged(reader):
>         print row
>         if final:
>             print 'final:', row
>         else:
>             print 'leads:', row
> 
> 
> --Scott David Daniels
> [EMAIL PROTECTED]


-- 
-Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to