[Tutor] (no subject)

Pujo Aji ajikoe at gmail.com
Thu May 26 09:29:47 CEST 2005


Actually you can do the same way:

    # Convert intAscii to charAscii
    S = [chr(x) for x in range(0,256)]
    for x in S: print x

    #Convert charAscii to intAscii
    AsciiInt = [ord(x) for x in S]
    for x in AsciiInt: print x

Best Regards,
pujo

On 5/26/05, John Carmona <jeannot18 at hotmail.com> wrote:
> With the help of Pujo Aji I have written this little script that print every
> single ASCII code>>
> 
> S = [chr(x) for x in range (0,256)]
> for x in S:
>     print x,
> 
> The next step is to use the built-in functin ord() in order to convert each
> character to an ASCII integer. I have had a look at the ord() function but
> it says that it only take one argument i.e. ord('a'). How could I execute to
> convert each character into an ASCII integer?
> 
> Thanks in advance
> JC
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list