By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,996 Members | 1,498 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,996 IT Pros & Developers. It's quick & easy.

How can I get the ascii code of a charter in python?

P: n/a
Hi,
a python newbe needs some help,

I read the python doc at
http://docs.python.org/lib/module-curses.ascii.html

I tried
Import curses.asciicurses.ascii
Print ascii('a')

I get an error saying module curses.ascii8 does not exsist.

How can I get the ascii code of a charter in python?

-Ted

May 1 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
te*******@gmail.com schrieb:
Hi,
a python newbe needs some help,

I read the python doc at
http://docs.python.org/lib/module-curses.ascii.html

I tried
Import curses.asciicurses.ascii
Print ascii('a')

I get an error saying module curses.ascii8 does not exsist.

How can I get the ascii code of a charter in python?
ord('A') == 65

Diez
May 1 '07 #2

P: n/a
On Tue, May 01, 2007 at 02:06:21PM -0700, te*******@gmail.com wrote:
How can I get the ascii code of a charter in python?
It's a builtin:
>>ord('*')
42

Dustin
May 1 '07 #3

P: n/a

On May 1, 2007, at 4:06 PM, te*******@gmail.com wrote:
Hi,
a python newbe needs some help,

I read the python doc at
http://docs.python.org/lib/module-curses.ascii.html

I tried
Import curses.asciicurses.ascii
Print ascii('a')

I get an error saying module curses.ascii8 does not exsist.

How can I get the ascii code of a charter in python?
Do you mean ord()?
May 1 '07 #4

P: n/a
On May 2, 7:06 am, "tedpot...@gmail.com" <tedpot...@gmail.comwrote:
How can I get the ascii code of a charter in python?
E.g. download from here:
http://www.gutenberg.org/ebooks/10000
then in Python, use:
text = open("the_file.txt").read()

HTH,
John

May 1 '07 #5

P: n/a
In article <11**********************@h2g2000hsg.googlegroups. com>,
John Machin <sj******@lexicon.netwrote:
>On May 2, 7:06 am, "tedpot...@gmail.com" <tedpot...@gmail.comwrote:
>How can I get the ascii code of a charter in python?

E.g. download from here:
http://www.gutenberg.org/ebooks/10000
then in Python, use:
text = open("the_file.txt").read()
May 2 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.