title: Is there a way to read a file in a loop in python using a separator other than newline
body: <p>I usually read files like this in Python:</p>
  
  <pre><code>f = open('filename.txt', 'r')
  for x in f:
      doStuff(x)
  f.close()
  </code></pre>
  
  <p>However, this splits the file by newlines.  I now have a file which has all of its info in one line (45,000 strings separated by commas).  While a file of this size is trivial to read in using something like</p>
  
  <pre><code>f = open('filename.txt', 'r')
  doStuff(f.read())
  f.close()
  </code></pre>
  
  <p>I am curious if for a much larger file which is all in one line it would be possible to achieve a similar iteration effect as in the first code snippet but with splitting by comma instead of newline, or by any other character?  </p>