Re: [Tutor] ascii encoding

2005-01-26 Thread Alan Gauld
> Whether or not it's positive or negative depends on which side of GMT/UTC > you are, of course :) Note that the result in is seconds, too: Which is insane since timezones have nothing to do with time offsets. Especially at the second level! Oh well, nothing is perfect! Alan G. (Feeling picky

Re: [Tutor] ascii encoding

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 02:56, Luis N wrote: In other words I have to do some arithmetic: import time time.timezone 0 The server is located in Dallas, Texas. Which means it's not properly configured. On UNIX systems, to configure the timezone, you must adjust /etc/localtime so that it's a symlink th

Re: [Tutor] ascii encoding

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 02:44, Tony Meyer wrote: time.timezone gives you, I think, the offset between your current timezone and GMT. However, being myself in the GMT zone, I don't know exactly if the returned offset is positive or negative (it returns 0 here, which makes sense :D ). Whether or not it's

Re: [Tutor] ascii encoding

2005-01-25 Thread Luis N
In other words I have to do some arithmetic: >>> import time >>> time.timezone 0 The server is located in Dallas, Texas. On Wed, 26 Jan 2005 15:44:48 +1300, Tony Meyer <[EMAIL PROTECTED]> wrote: > > time.timezone gives you, I think, the offset between > > your current timezone and GMT. However,

RE: [Tutor] ascii encoding

2005-01-25 Thread Tony Meyer
> time.timezone gives you, I think, the offset between > your current timezone and GMT. However, being myself in the GMT zone, > I don't know exactly if the returned offset is positive or negative > (it returns 0 here, which makes sense :D ). Whether or not it's positive or negative depends on wh

Re: [Tutor] ascii encoding

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 00:50, Luis N wrote: Ok, urllib.quote worked just fine, and of course so did urllib.pathname2url. I should have run a dir() on urllib. Those functions don't appear in http://docs.python.org/lib/module-urllib.html Now, how might one go about calculating the New York time off-se

Re: [Tutor] ascii encoding

2005-01-25 Thread Luis N
Ok, urllib.quote worked just fine, and of course so did urllib.pathname2url. I should have run a dir() on urllib. Those functions don't appear in http://docs.python.org/lib/module-urllib.html Now, how might one go about calculating the New York time off-set from GMT? The server is in the U.S. but

Re: [Tutor] ascii encoding

2005-01-24 Thread Kent Johnson
Kent Johnson wrote: >>> import re >>> def hexify(match): ... return '%%%X' % ord(match.group(0)) Ah, should be '%%%02X' ... Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] ascii encoding

2005-01-24 Thread Kent Johnson
Luis N wrote: How would I best turn this string: '2005-01-24 00:00:00.0' into this string: '2005%2D01%2D24%2000%3A00%3A00%2E0' In order to call a URL. urllib.quote_plus() is intended for this purpose though it doesn't have the result you ask for: >>> import urllib >>> s='2005-01-24 00:00:00.0'

Re: [Tutor] ascii encoding

2005-01-24 Thread Chad Crabtree
I got this from spyce http://spyce.sourceforge.net _url_ch = re.compile(r'[^A-Za-z0-9_.!~*()-]') # RFC 2396 section 2.3 def url_encode(o, **kwargs): '''Return URL-encoded string.''' return _url_ch.sub(lambda match: "%%%02X" % ord(match.group(0)), str(o)) It was just the first thing I found in

Re: [Tutor] ascii encoding

2005-01-24 Thread Max Noel
On Jan 24, 2005, at 23:29, Luis N wrote: How would I best turn this string: '2005-01-24 00:00:00.0' into this string: '2005%2D01%2D24%2000%3A00%3A00%2E0' In order to call a URL. I've hunted through the standard library, but nothing seemed to jump out. The pathname2url in urllib seems to do wha

[Tutor] ascii encoding

2005-01-24 Thread Luis N
How would I best turn this string: '2005-01-24 00:00:00.0' into this string: '2005%2D01%2D24%2000%3A00%3A00%2E0' In order to call a URL. I've hunted through the standard library, but nothing seemed to jump out. Thank You. ___ Tutor maillist - Tuto

[Tutor] ASCII encoding for a £ sign

2004-12-31 Thread David Holland
I ran a program with a "£" sign, and I got this message :- "sys:1: DeprecationWarning: Non-ASCII character '\xc2' in file birdgame32a.py on line 93, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details' I looked at the message but I am not sure what encoding to use fo