Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enter a pound sterling character (£) into the Python interactive shell on Mac OS X?

Update: Thanks for the suggestions guys. After further research, I’ve reformulated the question here: Python/editline on OS X: £ sign seems to be bound to ed-prev-word

On Mac OS X I can’t enter a pound sterling sign (£) into the Python interactive shell.

  • Mac OS X 10.5.5
  • Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
  • European keyboard (£ is shift-3)

When I type “£” (i.e. press shift-3) at an empty Python shell, nothing appears.

If I’ve already typed some characters, e.g.

>>> 1234567890 1234567890 1234567890

... then pressing shift-3 will make the cursor position itself after the most recent space, or the start of the line if there are no spaces left between the cursor and the start of the line.

In a normal bash shell, pressing shift-3 types a “£” as expected.

Any idea how I can type a literal “£” in the Python interactive shell?

like image 275
Paul D. Waite Avatar asked Dec 30 '22 09:12

Paul D. Waite


1 Answers

Not the best solution, but you could type:

 pound = u'\u00A3'

Then you have it in a variable you can use in the rest of your session.

like image 197
Patrick McElhaney Avatar answered Jan 04 '23 15:01

Patrick McElhaney