nirinA raseliarison schrieb:
why the following behavior:

    >>> b=b'thisisbytes'
    >>> b[0] == b't'
    False
    >>> b[0]
    116

i expected same thing as:

    >>> b.startswith(b't')
    True
    >>> b[0:1] == b't'
    True
    >>> b[0:1]
    b't'
    >>> b[:1]
    b't'

and this is a bit curious:

    >>> b[2:5]
    b'isi'
    >>> for i in b[2:5]:
        print(i)

    105
    115
    105

Yes. Bytes objects are sequences of bytes, which are integers.
So, in short, this is the way they work.

Georg

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to