title: extend list in python until condition is met
body: <p>I would like to create a list when <code>row[4]</code> is digit, then extend it with <code>row</code> whenever <code>row[4]</code> is not a digit but I am getting duplicate results. Can someone guide me in the right direction? </p>
  
  <p>this is a sample csv file:</p>
  
  <pre><code>Name,Last,,,Account
  joe,joe last,,,11111
  joe address,city,state,zip,
  ,,,,
  sam,sam last,,,22222
  sam address,city,state,zip,
  ,,,,
  bob,bob last,,,33333
  bob address,city,state,zip,
  </code></pre>
  
  <p>my code:</p>
  
  <pre><code>localdir = 'C:\\Users\\User\\My Documents'
  fn = 'test_file.csv'
  
  with open(os.path.join(localdir, fn), 'rb') as fopen:
      csvdata = list(csv.reader(fopen))
  
  data = []
  for row in csvdata:
      if not row[0] or row[0].startswith('Name'):
          continue
      if row[4].isdigit():
          accts = []
      accts += row
      data.append(accts)
  
  for line in data:
      print(line)
  </code></pre>
  
  <p>My results are:</p>
  
  <pre><code>['joe', 'joe last', '', '', '11111', 'joe address', 'city', 'state', 'zip', '']
  ['joe', 'joe last', '', '', '11111', 'joe address', 'city', 'state', 'zip', '']
  ['sam', 'sam last', '', '', '22222', 'sam address', 'city', 'state', 'zip', '']
  ['sam', 'sam last', '', '', '22222', 'sam address', 'city', 'state', 'zip', '']
  ['bob', 'bob last', '', '', '33333', 'bob address', 'city', 'state', 'zip', '']
  ['bob', 'bob last', '', '', '33333', 'bob address', 'city', 'state', 'zip', '']
  </code></pre>
  
  <p>I would like to get:</p>
  
  <pre><code>['joe', 'joe last', '', '', '11111', 'joe address', 'city', 'state', 'zip', '']
  ['sam', 'sam last', '', '', '22222', 'sam address', 'city', 'state', 'zip', '']
  ['bob', 'bob last', '', '', '33333', 'bob address', 'city', 'state', 'zip', '']
  </code></pre>