here's a simple way

numChar = 10
testText="akfldjliugflkjlsuagjlfnflgj"
for c in xrange(0,len(testText),numChar):
  print testText[c,c+numChar]

for slightly better performance you should probably do

numChar = 10
testText="akfldjliugflkjlsuagjlfnflgj"
lenText = len(testText)

for c in xrange(0,lenText,numChar):
  print testText[c,c+numChar]  # don't worry about over indexing it's
handled cleanly




f pemberton 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.

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

Reply via email to