hello all
I am trying to write a script in python that parses a gzipped logfile
the unzipped logfiles can be very large (>2GB)
basically the statements
file = gzip.GzipFile(logfile)
data = file.read()
for line in data.striplines():
would do what I want, but this is not feasible becasue t
Hello
how can I break a loop after a certain amount of time has passed?
pseudocode:
with timeout of 60sec:
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello
how can I break a loop after a certain amount of time has passed?
pseudocode:
with timeout of 60sec:
while True:
pass
is there a simple way? without resorting to queues etc. (this is a bit
over my head)
thanks for any insight you might have
-frank
On 1/16/06, frank h
Hello List,i am trying to convert local Swedish daynames to ASCII"Måndag" should become "Mandag""Lördag" should become "Lordag""Söndag" should become "Sondag"
here is my sessionimport localelocale.setlocale(locale.LC_ALL, 'sv_Se')datetime.date(2006, 06, 19).strftime("%A")'M\xc3\xa5ndag'datetime.dat
hello, i have a string variable that contains a name that I want to use as a variablenameputting aside questions of why I would like to do that - i this possible at all?so I want to assign a value to a variable whos name is available only as a string to me.
that variable does not exist yet in the
Hello all,I wrote a script on UNIX that uses the following statements:import locale, datetimelocale.setlocale(locale.LC_ALL, 'sv_Se')with that, I can get localized dates like this> datetime.datetime.today
().strftime('%A')'Fredag'problem is, this doesnt work on windows!I get:locale.Error: unsupport
Hello all,
using python 2.4.4, I have the following session on Mac OS X:
import datetime, locale
locale.setlocale(locale.LC_ALL, 'se_SE')
t=datetime.date(2007,01,29).strftime("%A")
t
'M?\xa5ndag'
type(t)
t.decode('utf8')
u'M\xe5ndag'
fantastic! I just got the unicode version of the swedish name
hm I guess I found an answer myself
on windows, the default encoding is not 'utf8'
thus, if I use
encoding = locale.getlocale()[1]
t.decode(encoding)
instead of
t.decode('utf8')
it works
On 1/31/07, frank h. <[EMAIL PROTECTED]> wrote:
Hello all,
using python 2
so what is the easiest way to to get to a list of months in a given
timeinterval, e.g.
startdate = datetime.date(2005,2,13)
enddate = datetime.date(2007,1,25)
delta = enddate - startdate
delta.days
711
delta.months
exceptions.AttributeErrorTraceback (most recent
ca
thanks kent for your fast and comprehensive answer!
On 2/5/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
frank h. wrote:
> so what is the easiest way to to get to a list of months in a given
> timeinterval, e.g.
>
> >> startdate = datetime.date(2005,2,13)
> >>
hello all
here is a disturbing session with min() and max() for which I have
absolutely no explanation
t = (952L, 945L, 941L, 939L, 949L, 972L, 956L, 965L, 973L, 965L)
min(t)
939L
max(t)
exceptions.TypeError Traceback (most recent
call last)
TypeError: 'int' ob
:-))
turns out I found the problem: max was a local integer variable in my
namespace. as such it was obviously not callable
On 2/7/07, frank h. <[EMAIL PROTECTED]> wrote:
hello all
here is a disturbing session with min() and max() for which I have
absolutely no explanation
>>
12 matches
Mail list logo