On Thu, 10 Aug 2006 11:39:41 -0700 f pemberton <[EMAIL PROTECTED]> wrote:
#> I have kind of an interesting string, it looks like a couple hundred #> letters bunched together with no spaces. Anyway, i'm trying to put a #> "?" and a (\n) newline after every 100th character of the string and #> then write that string to a file. How would I go about doing that? Any #> help would be much appreciated. In addition to all the other ideas, you can try using StringIO import StringIO s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' size = 10 # 100 input = StringIO.StringIO(s) while input.tell()<input.len: # is there really no better way to check for exhausted StringIO ? print input.read(size)+"?\n", # instead of print just write to a file or accumulate the result -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) "Reality is that which, when you stop believing in it, doesn't go away." -- Philip K. Dick -- http://mail.python.org/mailman/listinfo/python-list