L
Laszlo Zsolt Nagy
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"
After all, only the last 50 bytes are printed. The string is the same
(length 20381) in both cases.
Surprisingly, I can print more than 50 characters, this works:
print "012345678901234567890123456789012345678901234567890123456789A"
I'm sure it is my mistake, but I don't know what am I doing wrong. Do
you have an idea?
Thanks,
Les
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"
After all, only the last 50 bytes are printed. The string is the same
(length 20381) in both cases.
Surprisingly, I can print more than 50 characters, this works:
print "012345678901234567890123456789012345678901234567890123456789A"
I'm sure it is my mistake, but I don't know what am I doing wrong. Do
you have an idea?
Thanks,
Les