[Tutor] (no subject)
Ben Vinger
benvinger at yahoo.co.uk
Thu May 26 10:32:50 CEST 2005
Or like this:
for x in range (0,256):
print ord(chr(x)), ': ', chr(x)
(you could just print x, instead of ord(chr(x)), but
then you would not be using ord)
Ben
--- Pujo Aji <ajikoe at gmail.com> wrote:
> 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
> >
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___________________________________________________________
Can't remember an address in your address book? Enter the first few letters and Address AutoComplete will automatically finish it.
Get Yahoo! Mail http://uk.mail.yahoo.com
More information about the Tutor
mailing list