[Tutor] How can I escape a pound symbol in my script?

Kent Johnson kent37 at tds.net
Fri Jul 6 12:48:34 CEST 2007

Alan Gauld wrote:
> Moving somewhat off topic...
>>> file). I need to write out a pound sign '#' to the file
>> Works fine here:
>> $ python -c 'open("foo","w").write("£")'
> I always find it amusing when Americans refer to the
> hash or square symbol (#) as a pound sign (£). This
> is of course an historical feature of old keyboards
> when, to get a hash symbol (#), you had to type a
> pound sign(£), ie shift 3.

That is a very interesting explanation but I prefer this one:

# is an abbreviation for 'pound' the weight, not 'pound' the unit of 

Of course the correct name for this symbol is 'octothorpe' :-)


More information about the Tutor mailing list