Hi how do I get a £ to print in python 2.4.1.
if I type print "£" in the terminal it works fine
if I try to to that from a script it comes up with a Deprecationwarning no encoding selected and prints (don't know how to get the character to appear on here, but it is a A with a "^" above it) and the £, ie. it prints A£
if I include

# -*- coding: utf-8 -*-
in the script the Deprecation Warning disappears but it still print A£

Recommended Answers

All 2 Replies

I have not such old Python, but for me works normally in Windows:

# -*- coding: cp1252 -*-
Microsoft Windows XP [versio 5.1.2600]
(C) Copyright 1985 - 2001 Microsoft Corp.


Uinicode should work regardless of the encoding used.

print unichr(163)
print u"\u00A3"

Microsoft Windows [Versjon 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Med enerett.

C:\>python u.py
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.