Very dumb question
bruno modulix
onurb at xiludom.gro
Wed Oct 12 09:53:26 EDT 2005
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"
>
> After all, only the last 50 bytes are printed. The string is the same
> (length 20381) in both cases.
(snip
> I'm sure it is my mistake, but I don't know what am I doing wrong. Do
> you have an idea?
I assume the code snippets are exact copy/paste so this is not a typo
(like print data[51:] ...) - and I can't reproduce it here... even with
a string of 20381 characters.
mmm...
type(data) ???
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list