#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    15
    Rep Power
    0

    Number of bytes vs number of elements?


    Hey guys,

    How do you code these two things? For example, a list with 100 elements in it, versus a list with 100 bytes, which ends up being 128 elements.

    I am confused on this.

    Thanks
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,703
    Rep Power
    480
    bytes might refer to the bytes literal, rather than to a unit of computer memory.

    b'I am bytes'

    bytes in recent python2 and python3:
    Code:
    $ python
    Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> bytes
    <type 'str'>
    >>> 
    $ python3
    Python 3.2.3 (default, Sep 10 2012, 18:14:40) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> bytes
    <class 'bytes'>
    >>>
    Last edited by b49P23TIvg; October 19th, 2012 at 12:33 PM.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    15
    Rep Power
    0
    Originally Posted by b49P23TIvg
    bytes might refer to the bytes literal, rather than to a unit of computer memory.

    b'I am bytes'

    bytes in recent python2 and python3:
    I see, that makes perfect sense. I did not think about the other meaning of bytes

    Thank you!

IMN logo majestic logo threadwatch logo seochat tools logo