Type conversion?

Rob Cowie cowie.rob at gmail.com
Fri Aug 18 11:45:14 EDT 2006


KraftDiner wrote:
> I have the following code...
>
> import array
> len32 = array.array('L')
> len16 = array.array('H')
>
> len32.append(0)
> len16.append(0)
>
> y = len32[0]
> print y.__class__
> <type 'long'>
> z = len16[0]
> print z.__class__
> <type 'int'>
>
> how can I change Zs type to long?

z_long = long(z)
type(z_long)
<type 'long'>

> Or how how can I change an arrays type?




More information about the Python-list mailing list