[pyar] Preguntas para saber si sabe Python

Claudio Freire klaussfreire en gmail.com
Vie Ago 24 13:57:57 ART 2012


2012/8/24 Roberto Alsina <ralsina en netmanagers.com.ar>:
>> 1- ¿Como comprobas el tipo de un objeto?
>> 2- Explicame la diferencia entre bytes y string (en Python 2,x)
>
>
> En python 2.x no existe el tipo bytes, y lo que es el tipo bytes en python 3
> es el tipo string. Era pregunta con trampa?

Ojo, python 2.6+ tiene bytes (alias de str), y un muy similar pero
fundamentalmente diferente "bytearray":

claudiofreire en klauss:~$ python
Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> bytearray
<type 'bytearray'>
>>> bytes
<type 'str'>
>>>



More information about the pyar mailing list