Laszlo Zsolt Nagy wrote: > I have a program with this code fragment: > > print len(data) > print data[:50] > raise SystemExit > > This prints: > > 20381 > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > > But if I change 50 to 51 > > print len(data) > print data[:51] > raise SystemExit > > then it prints > > 20381 > !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
The closest I can get to your situation is [on linux] >>> print "abc\rx"[:4] abc >>> print "abc\rx"[:5] xbc i. e. a character after a 'carriage return' ('\r') overwrites part of the string which therefore doesn't seem to grow. Try print repr(data[:51]) to see what's really in your data string. Peter -- http://mail.python.org/mailman/listinfo/python-list