On 2022-06-21 05:29:52 +0100, Paulo da Silva wrote:
> I implemented a part of a script to subtract n months from datetime.
> Basically I subtracted n%12 from year and n//12 from the month adding 12
> months when it goes<=0. Then used try when converting to datetime again. So,
> if
> What makes sense depends on where you're looking from.
>
> It's 28 February, you need to keep it for 5 years, therefore you could
> reason that you can dispose of it on 28 February, 5 years hence.
>
> However, that happens to be a leap year.
>
> Should you still have it on 29 February?
Nope beca
Às 19:47 de 22/06/22, Marco Sulla escreveu:
The package arrow has a simple shift method for months, weeks etc
https://arrow.readthedocs.io/en/latest/#replace-shift
At first look it seems pretty good! I didn't know it.
Thank you Marco.
Paulo
--
https://mail.python.org/mailman/listinfo/python-l
Às 20:25 de 22/06/22, Barry Scott escreveu:
On 22 Jun 2022, at 17:59, Paulo da Silva
wrote:
Às 05:29 de 21/06/22, Paulo da Silva escreveu:
As a general response to some comments ...
Suppose we need to delete records from a database older than ...
Today, it's usual to specify days. For exa
On 2022-06-22 20:25, Barry Scott wrote:
On 22 Jun 2022, at 17:59, Paulo da Silva
wrote:
Às 05:29 de 21/06/22, Paulo da Silva escreveu:
As a general response to some comments ...
Suppose we need to delete records from a database older than ...
Today, it's usual to specify days. For example
> On 22 Jun 2022, at 17:59, Paulo da Silva
> wrote:
>
> Às 05:29 de 21/06/22, Paulo da Silva escreveu:
>
> As a general response to some comments ...
>
> Suppose we need to delete records from a database older than ...
> Today, it's usual to specify days. For example you have to keep some go
The package arrow has a simple shift method for months, weeks etc
https://arrow.readthedocs.io/en/latest/#replace-shift
--
https://mail.python.org/mailman/listinfo/python-list
On 2022-06-22 17:59, Paulo da Silva wrote:
Às 05:29 de 21/06/22, Paulo da Silva escreveu:
As a general response to some comments ...
Suppose we need to delete records from a database older than ...
Today, it's usual to specify days. For example you have to keep some gov
papers for 90 days. This
Às 05:29 de 21/06/22, Paulo da Silva escreveu:
As a general response to some comments ...
Suppose we need to delete records from a database older than ...
Today, it's usual to specify days. For example you have to keep some gov
papers for 90 days. This seems to come from computers era. In our m
On 21Jun2022 17:02, Paulo da Silva wrote:
>I have a datetime, not a date.
Then you need a date. I would break the datetime into a date and a time,
then do the months stuff to the date, then compose a new datetime from
the result.
>Anyway, the use of calendar.monthrange simplifies the
month = (value.month - 1 + n) % 12 + 1
day = min(value.day, calendar.monthrange(year, month)[1])
return date(year, month, day)
Paul
I have a datetime, not a date.
Anyway, the use of calendar.monthrange simplifies the task a lot.
Assuming dtnow has the current datetime and dtn the number of m
On Mon, Jun 20, 2022 at 9:45 PM Paul Bryan wrote:
> Here's how my code does it:
>
>
> import calendar
>
> def add_months(value: date, n: int):
> """Return a date value with n months added (or subtracted if
> negative)."""
> year = value.year + (value.month - 1 + n) // 12
> month = (value.mo
On 6/21/22 12:29 AM, Paulo da Silva wrote:
Hi!
I implemented a part of a script to subtract n months from datetime.
Basically I subtracted n%12 from year and n//12 from the month adding
12 months when it goes<=0. Then used try when converting to datetime
again. So, if the day is for exam
min(value.day, calendar.monthrange(year, month)[1])
return date(year, month, day)
Paul
On Tue, 2022-06-21 at 05:29 +0100, Paulo da Silva wrote:
> Hi!
>
> I implemented a part of a script to subtract n months from datetime.
> Basically I subtracted n%12 from year and n//12 from the mo
Hi!
I implemented a part of a script to subtract n months from datetime.
Basically I subtracted n%12 from year and n//12 from the month adding 12
months when it goes<=0. Then used try when converting to datetime again.
So, if the day is for example 31 for a 30 days month it raises a
ValuEr
h a nightmare, and programmes
working with datetime as their primary structure are fragile (hmm, is
this _naive_ (untimezoned) datetime in local time? What _is_ local time? Was
the naive datetime obtained correctly? etc).
Hence the common recommendation to work in seconds since an epoch (on
U
On 16 Oct 2020 12:50, Eryk Sun wrote:
On 10/16/20, Steve wrote:
> -Original Message-
> From: Python-list
On
> Behalf Of Frank Millman
> Sent: Friday, October 16, 2020 4:34 AM
> To: python-list@python.org
> Subject: Re: How do
psychology, to they cancel
> each other out?
>
> --
py>
py> import datetime as dt
py>
py> d = dt.datetime.now().strftime( '%Y-%m-%d %H:%M' )
py>
py> print( '\n ' , d )
2020-10-16 07:22
--
Stanley C. Kitching
Human Being
Phoenix, Arizona
--
https://mail.python.org/mailman/listinfo/python-list
On 10/16/20, Steve wrote:
> -Original Message-
> From: Python-list On
> Behalf Of Frank Millman
> Sent: Friday, October 16, 2020 4:34 AM
> To: python-list@python.org
> Subject: Re: How do I get datetime to stop showing seconds?
>
> On 2020-10-16 9:4
Right on target,
Many Thanks
FootNote:
If money does not grow on trees, then why do banks have branches?
-Original Message-
From: Python-list On
Behalf Of Frank Millman
Sent: Friday, October 16, 2020 4:34 AM
To: python-list@python.org
Subject: Re: How do I get datetime to stop
Another way is:
'{:%Y-%m-%d %H:%M}'.format(d2)
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-10-16 9:42 AM, Steve wrote:
d2 = datetime.datetime.now() #Time Right now
Show this: 2020-10-16 02:53
and not this: 2020-10-16 02:53:48.585865
>>>
>>> str(d2)
'2020-10-16 10:29:38.423371'
>>>
>>> d2.strftime('%Y-%m-%d %H:%M')
'2020-10-16 10:29'
>>>
Frank Millman
--
https://mail.pyt
d2 = datetime.datetime.now() #Time Right now
Show this: 2020-10-16 02:53
and not this: 2020-10-16 02:53:48.585865
==
Footnote:
If you double major in psychology and reverse psychology, to they cancel
each other out?
--
--
https://m
r just import the objects that you need;
>
> from datetime import datetime, SYMBOL, etc...
>
> I use Decimal a lot. I would hate to have to write "decimal.Decimal(str)"
> for example.
>
> Whichever method you use the most important thing is to be consistent as
> much as
On 10/12/20 7:20 AM, Chris Angelico wrote:
> This is yet another reason that "from MODULE import *" is a bad idea.
> Instead, just import the module itself, and take whatever you need.
Or just import the objects that you need;
from datetime import datetime, SYMBOL, etc...
I u
On 13/10/2020 06:47, Steve wrote:
Thank you, those two fixes took care of the problem.
At the top of my sample program, I have:
import datetime
from datetime import *
...
These are incompatible with each other, so you're going to get issues.
I'd recommend doing just the first one
: Re: What might cause my sample program to forget that already
imported datetime?
On Mon, Oct 12, 2020 at 9:14 PM Steve wrote:
>
> At the top of my sample program, I have:
>
> import datetime
> from datetime import *
>
> But import datetime also has to be entered on line 21 a
On 10/12/20 7:20 AM, Chris Angelico wrote:
> On Mon, Oct 12, 2020 at 9:58 PM Abdur-Rahmaan Janhangeer
> wrote:
>> Btw why a datetime in datetime?
>>
>> It causes much confusion. I dont know
>> the design decision behind, if someone knows, it might be good to expl
On Mon, Oct 12, 2020 at 9:58 PM Abdur-Rahmaan Janhangeer
wrote:
>
> Btw why a datetime in datetime?
>
> It causes much confusion. I dont know
> the design decision behind, if someone knows, it might be good to explain
>
There are quite a few modules that have one "most o
Btw why a datetime in datetime?
It causes much confusion. I dont know
the design decision behind, if someone knows, it might be good to explain
I dont expect it to change anytime soon
due to backward compatibility, but just
for knowledge.
Kind Regards,
Abdur-Rahmaan Janhangeer
https
On Mon, Oct 12, 2020 at 9:14 PM Steve wrote:
>
> At the top of my sample program, I have:
>
> import datetime
> from datetime import *
>
> But import datetime also has to be entered on line 21 as shown.
> The error is printed at the bottom of the code.
> Why does the
On Mon, Oct 12, 2020 at 6:14 AM Steve wrote:
>
> At the top of my sample program, I have:
>
> import datetime
> from datetime import *
This second import tramples on the first. What happens if you remove it?
>
> But import datetime also has to be entered on line 21 as
At the top of my sample program, I have:
import datetime
from datetime import *
But import datetime also has to be entered on line 21 as shown.
The error is printed at the bottom of the code.
Why does the code seem to forget that I have already imported datetime
On 11Oct2020 20:39, Steve wrote:
>Still, I enjoyed the kluge I created making it work based on discovery...
Poking around in the datetime module will definitely make you aware of
its power, and its pitfalls. Well worth doing. At the very least you'll
usually want it when printing times
Thanks for the responses. Somehow, all of my python messages were shifted
into the deleted folder so I missed all of them until I caught the one from
MRAB.
I will sift through them and probably update my technique to use seconds as
suggested.
Still, I enjoyed the kluge I created making it work b
On 2020-10-11 20:25, Steve wrote:
Thanks for the response.
I must have spent hours looking on-line for a method to treat datetime
variables yet not one site mentioned the "pickle" module you indicatged. I
did, however solve my problem. It may be a kluge but it seems to work.
I lear
Thanks for the response.
I must have spent hours looking on-line for a method to treat datetime
variables yet not one site mentioned the "pickle" module you indicatged. I
did, however solve my problem. It may be a kluge but it seems to work.
I learned that I cannot use print() to d
On Sun, Oct 11, 2020 at 12:57 PM Cameron Simpson wrote:
> Personally I strongly dislike using datetimes for computation or as the
> basis for time record keeping, essentially because of the timezone issue
> but also because the human calendar is a complex disaster of illfitting
> units (days in a
d2 to the file only if I convert it to string and, at a later
>date, it gets read back in as d1 as string.
That is the nature of text files.
>The variable d1 as string will
>not work in the HoursDiff statement.
Because it is a string.
Peter has described a way to transcribe a datetime i
On Sat, 10 Oct 2020 18:17:26 -0400, Steve wrote:
> I would like to use the line:
> HoursDiff = int((d2-d1).total_seconds()/3600)
> to determine the difference in hours between two timedate entries.
>
> The variable d2 is from datetime.now()
> and d1 is read from a text file.
>
> I can save d2 to t
I would like to use the line:
HoursDiff = int((d2-d1).total_seconds()/3600)
to determine the difference in hours between two timedate entries.
The variable d2 is from datetime.now()
and d1 is read from a text file.
I can save d2 to the file only if I convert it to string and, at a later
date, it
On 13/02/20 9:17 AM, Michael Torrie wrote:
On 2/12/20 7:44 AM, Ethan Furman wrote:
On 02/11/2020 04:38 PM, Michael Torrie wrote:
...
True. Costs can be calculated and planned for. But Technical debt is
often impossible to quantify in a real, meaningful, business sense,
other than the that we
On 2/12/20 7:44 AM, Ethan Furman wrote:
> On 02/11/2020 04:38 PM, Michael Torrie wrote:
>
>> It's all just different ways of accounting for the same things. In
>> the olden days before the term "technical debt" was invented, we
>> called this "total cost of ownership."
>
> TCO is not a fixed numb
On 12/02/2020 17:46, Python wrote:
On Wed, Feb 12, 2020 at 01:16:03PM +, Rhodri James wrote:
On 12/02/2020 00:53, Python wrote:
In pretty much every job I've ever worked at, funding work (e.g. with
humans to do it) with exactly and precisely the resources required is
basically impossible, a
On Wed, Feb 12, 2020 at 01:16:03PM +, Rhodri James wrote:
> On 12/02/2020 00:53, Python wrote:
> > In pretty much every job I've ever worked at, funding work (e.g. with
> > humans to do it) with exactly and precisely the resources required is
> > basically impossible, and management prefers to
t: Re: Technical debt - was Re: datetime seems to be broken WRT
timezones (even when you add them)
On 12/02/2020 00:53, Python wrote:
> In pretty much every job I've ever worked at, funding work (e.g. with
> humans to do it) with exactly and precisely the resources required is
> basica
On 02/11/2020 04:38 PM, Michael Torrie wrote:
It's all just different ways of accounting for the same things. In the
olden days before the term "technical debt" was invented, we called this
"total cost of ownership."
TCO is not a fixed number. For example, if a loan is taken to help fund a pr
On 12/02/2020 00:53, Python wrote:
In pretty much every job I've ever worked at, funding work (e.g. with
humans to do it) with exactly and precisely the resources required is
basically impossible, and management prefers to underfund the work
than to overfund it, for cost-savings reasons. This ba
On 2020-02-12, Chris Angelico wrote:
> But you CAN rewrite code such that it reduces technical debt. You can
> refactor code to make it more logical.
... but if doing so costs more than the debt, you shouldn't do it.
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Feb 12, 2020 at 12:32 PM Michael Torrie wrote:
>
> On 2/11/20 6:15 PM, Chris Angelico wrote:
> > On Wed, Feb 12, 2020 at 12:13 PM Michael Torrie wrote:
> >>
> >> On 2/11/20 5:55 PM, Chris Angelico wrote:
> >>> But you CAN rewrite code such that it reduces technical debt. You can
> >>> ref
On 2/11/20 6:15 PM, Chris Angelico wrote:
> On Wed, Feb 12, 2020 at 12:13 PM Michael Torrie wrote:
>>
>> On 2/11/20 5:55 PM, Chris Angelico wrote:
>>> But you CAN rewrite code such that it reduces technical debt. You can
>>> refactor code to make it more logical. You can update things to use
>>> i
On 2/11/20 5:53 PM, Python wrote:
> If your hypothetical project was implemented perfectly from the
> beginning, in Python2.x, it may never need updating, and therefore
> there may well never be any reason to port it to python3. So doing so
> would be neither "debt" nor "cost" but rather "waste."
On Wed, Feb 12, 2020 at 12:13 PM Michael Torrie wrote:
>
> On 2/11/20 5:55 PM, Chris Angelico wrote:
> > But you CAN rewrite code such that it reduces technical debt. You can
> > refactor code to make it more logical. You can update things to use
> > idioms that better express the concepts you're
On 2/11/20 5:55 PM, Chris Angelico wrote:
> But you CAN rewrite code such that it reduces technical debt. You can
> refactor code to make it more logical. You can update things to use
> idioms that better express the concepts you're trying to represent
> (maybe because those idioms require syntacti
On Wed, Feb 12, 2020 at 12:00 PM Michael Torrie wrote:
>
> On 2/11/20 5:42 PM, Chris Angelico wrote:
> > Yes, if you consider the term to be synonymous with TCO, then
> > naturally you'll see it as useless. But it isn't. Technical debt is a
> > very specific thing and it CAN be paid off.
>
> We'll
On 2/11/2020 3:09 PM, Chris Angelico wrote:
What you're talking about is costs in general, but "debt" is a very
specific term. You accrue technical debt whenever you "borrow" time
from the future - doing something that's less effort now at the
expense of being worse in the future.
A prime examp
On Wed, Feb 12, 2020 at 11:48 AM Michael Torrie wrote:
>
> On 2/11/20 5:37 PM, Chris Angelico wrote:
> > On Wed, Feb 12, 2020 at 11:32 AM Michael Torrie wrote:
> >>
> >> On 2/11/20 2:25 PM, Barry Scott wrote:
> >>> At Chris said moving to python3 will *reduce* your technical debt.
> >>> You are p
On 2/11/20 5:42 PM, Chris Angelico wrote:
> Yes, if you consider the term to be synonymous with TCO, then
> naturally you'll see it as useless. But it isn't. Technical debt is a
> very specific thing and it CAN be paid off.
We'll agree to disagree on the last bit. And I'm not the only one that
bel
On Wed, Feb 12, 2020 at 07:09:12AM +1100, Chris Angelico wrote:
> On Wed, Feb 12, 2020 at 7:03 AM Michael Torrie wrote:
> > Speaking about technical debt is certainly fashionable these days. As
> > if we've somehow discovered a brand new way of looking at things. But
> > it doesn't matter what y
On 2/11/20 5:37 PM, Chris Angelico wrote:
> On Wed, Feb 12, 2020 at 11:32 AM Michael Torrie wrote:
>>
>> On 2/11/20 2:25 PM, Barry Scott wrote:
>>> At Chris said moving to python3 will *reduce* your technical debt.
>>> You are paying off the debt.
>>
>> While at the same time incurring new debt.
>
On Wed, Feb 12, 2020 at 11:39 AM Michael Torrie wrote:
>
> On 2/11/20 1:09 PM, Chris Angelico wrote:
> > What you're talking about is costs in general, but "debt" is a very
> > specific term. You accrue technical debt whenever you "borrow" time
> > from the future - doing something that's less eff
On 2/11/20 1:09 PM, Chris Angelico wrote:
> What you're talking about is costs in general, but "debt" is a very
> specific term. You accrue technical debt whenever you "borrow" time
> from the future - doing something that's less effort now at the
> expense of being worse in the future. You pay off
On Wed, Feb 12, 2020 at 11:32 AM Michael Torrie wrote:
>
> On 2/11/20 2:25 PM, Barry Scott wrote:
> > At Chris said moving to python3 will *reduce* your technical debt.
> > You are paying off the debt.
>
> While at the same time incurring new debt.
That's not an intrinsic part of the rewrite, and
On 2/11/20 2:25 PM, Barry Scott wrote:
> At Chris said moving to python3 will *reduce* your technical debt.
> You are paying off the debt.
While at the same time incurring new debt.
> Not to mention that its harder to hire people to work on tech-debt legacy
> code.
>
> Given the choice between
> On 11 Feb 2020, at 20:01, Michael Torrie wrote:
>
> On 2/11/20 4:05 AM, Chris Angelico wrote:
>> Or just the recognition that, eventually, technical debt has to be
>> paid.
>
> Speaking about technical debt is certainly fashionable these days. As
> if we've somehow discovered a brand new
> On 10 Feb 2020, at 23:01, Python wrote:
>
> As best I can tell, Python has no means to make use of the system's
> timezone info. In order to make datetime "timezone aware", you need
> to manually create a subclass of datetime.tzinfo, whose methods retur
On Wed, Feb 12, 2020 at 7:03 AM Michael Torrie wrote:
>
> On 2/11/20 4:05 AM, Chris Angelico wrote:
> > Or just the recognition that, eventually, technical debt has to be
> > paid.
>
> Speaking about technical debt is certainly fashionable these days. As
> if we've somehow discovered a brand new
On Wed, Feb 12, 2020 at 6:45 AM Python wrote:
>
> On Wed, Feb 12, 2020 at 05:38:38AM +1100, Chris Angelico wrote:
> > > > Isn't it time to stop going to great effort to support Python
> > >
> > > If you live in a world where you get to decide that, sure. Not
> > > everyone does.
> > >
> >
> > Eve
On 2/11/20 4:05 AM, Chris Angelico wrote:
> Or just the recognition that, eventually, technical debt has to be
> paid.
Speaking about technical debt is certainly fashionable these days. As
if we've somehow discovered a brand new way of looking at things. But
it doesn't matter what you do, there
On Wed, Feb 12, 2020 at 05:38:38AM +1100, Chris Angelico wrote:
> > > Isn't it time to stop going to great effort to support Python
> >
> > If you live in a world where you get to decide that, sure. Not
> > everyone does.
> >
>
> Everyone gets to decide how much time and effort they put into
> su
On Wed, Feb 12, 2020 at 3:57 AM Python wrote:
>
> On Tue, Feb 11, 2020 at 12:42:26PM +1100, Chris Angelico wrote:
> > > > I've been using the timestamp() method:
> > >
> > > That's the key piece of info. This does appear to work, though still
> > > not on python2. That, as you say, is my problem
On Tue, Feb 11, 2020 at 12:42:26PM +1100, Chris Angelico wrote:
> > > I've been using the timestamp() method:
> >
> > That's the key piece of info. This does appear to work, though still
> > not on python2. That, as you say, is my problem. But thankfully Jon
> > Ribbens has the save:
>
> Isn't
On 2020-02-11, Chris Angelico wrote:
> On Tue, Feb 11, 2020 at 10:01 PM Jon Ribbens via Python-list
> wrote:
>> So while it's been about 6 years since anyone should have been
>> starting any new projects using Python 2, there are plenty of
>> projects that are older than that and still need suppor
Jon
> >> Ribbens has the save:
> >
> > Isn't it time to stop going to great effort to support Python 2?
>
> That depends on what existing systems people need to support. The main
> project I work on pre-dates the existence of Python's 'datetime'
> module, let
support Python 2?
That depends on what existing systems people need to support. The main
project I work on pre-dates the existence of Python's 'datetime'
module, let alone Python 3. It still generally uses 1 and 0 for True
and False because True and False didn't exist when we starte
On Tue, Feb 11, 2020 at 12:31 PM Python wrote:
>
> On Tue, Feb 11, 2020 at 11:33:54AM +1100, Chris Angelico wrote:
> > [...] instead of using the undocumented and unsupported strftime %s
> > format code
>
> I'm not sure this characterization is accurate... the docs (for both
> Python 2 and 3) say:
On Tue, Feb 11, 2020 at 11:33:54AM +1100, Chris Angelico wrote:
> [...] instead of using the undocumented and unsupported strftime %s
> format code
I'm not sure this characterization is accurate... the docs (for both
Python 2 and 3) say:
The full set of format codes supported varies across pl
x27;1580434245'
If you need to know the seconds since the epoch then in Python 3.3+
you can do that with dt.timestamp(). In Python 2.7 you can use the UTC
class you created:
(dt - datetime(1970, 1, 1, 0, 0, 0, 0, GMT())).total_seconds()
--
https://mail.python.org/mailman/listinfo/python-list
instance of this class as the tzinfo argument to the
> > > constructor. Also no problem:
> >
> > Rather than try to create your own GMT() object, have you considered
> > using datetime.timezone.utc ? I tested it in your examples and it
> > works just
tor. Also no problem:
>
> Rather than try to create your own GMT() object, have you considered
> using datetime.timezone.utc ? I tested it in your examples and it
> works just fine.
Not here it doesn't:
>>> import datetime
>>> dt = datetime.datetime(20
On Tue, Feb 11, 2020 at 10:42 AM Python wrote:
>
> As best I can tell, Python has no means to make use of the system's
> timezone info. In order to make datetime "timezone aware", you need
> to manually create a subclass of datetime.tzinfo, whose methods return
&
On Mon, Feb 10, 2020 at 05:52:59PM -0600, Skip Montanaro wrote:
> > As best I can tell, Python has no means to make use of the system's
> > timezone info. In order to make datetime "timezone aware", you need
> > to manually create a subclass of datetime.tzi
> As best I can tell, Python has no means to make use of the system's
> timezone info. In order to make datetime "timezone aware", you need
> to manually create a subclass of datetime.tzinfo, whose methods return
> the correct values for the timezone you care about.
&g
As best I can tell, Python has no means to make use of the system's
timezone info. In order to make datetime "timezone aware", you need
to manually create a subclass of datetime.tzinfo, whose methods return
the correct values for the timezone you care about. In the general
cas
On 2019-12-11 10:51 PM, Skip Montanaro wrote:
Why is a dtm instance also an instance of dt?
The datetime type is, in fact, a subclass of the date type:
import datetime
datetime.date.__bases__
(,)
datetime.datetime.__bases__
(,)
datetime.time.__bases__
(,)
Skip
Thanks for that.
I
> Why is a dtm instance also an instance of dt?
The datetime type is, in fact, a subclass of the date type:
>>> import datetime
>>> datetime.date.__bases__
(,)
>>> datetime.datetime.__bases__
(,)
>>> datetime.time.__bases__
(,)
Skip
--
https://mail.python.org/mailman/listinfo/python-list
Hi all
It took me a while to track down a bug that stemmed from this -
>>> from datetime import date as dt, time as tm, datetime as dtm
>>> x = dt.today()
>>> isinstance(x, dt)
True
>>> isinstance(x, dtm)
False
>>
ot;thin wrapper" (and most of the provided 'convenience
functions') to disappear in your rear-view mirror!
I stole a custom formatter class from a StackOverflow thread and am
now back in business (milliseconds *and* timezones, yay!). Still,
peeking at the 2.7 documentation, I see t
zones, and
sometimes need subsecond time resolution for quick-n-dirty analysis.
I stole a custom formatter class from a StackOverflow thread and am
now back in business (milliseconds *and* timezones, yay!). Still,
peeking at the 2.7 documentation, I see that both the logging package
and the dat
Actually i just found it has a directive:
dictrows: Whether or not to support dict-like access to row objects (default:
True).
so i just did:
plugin = bottle_pymysql.Plugin( dbuser='nikos', dbpass='*',
dbname='counters', dictrows=False )
and now it works with indexes as integers not as st
len( newdata ) - 1 # Save index (for
> 'newdata') of this row
> else: # This row is a duplicate row with a different
> referrer & visit datetime & torrent download
> rowindex = seen[key]
>
data.append( [ [host], [ref], location, useros,
browser, [visits], hits, [downloads], authuser ] )
seen[key] = len( newdata ) - 1 # Save index (for
'newdata') of this row
else: # This row is a duplicate row with a different
refer
On 26/02/19 7:47 AM, Dennis Lee Bieber wrote:
On Mon, 25 Feb 2019 13:00:03 -0500, Dennis Lee Bieber
declaimed the following:
My apologies for the mis-attribution -- due to spam, I tend to filter
out @gmail.com posts (the one flaw with Forte Agent -- it only filters news
groups on subje
if key not in seen:
newdata.append( [ [host], [ref], location,
useros, browser, [visits], hits, [downloads], authuser ] )
seen[key] = len( newdata ) - 1 # Save
index (for 'newda
want an html row for every unique combination of
> (host) and that hits should be summed together
> key = host
> if key not in seen:
> newdata.append( [ [host], [ref], location,
> useros, browser,
nd that hits should be summed together
key = host
if key not in seen:
newdata.append( [ [host], [ref], location,
useros, browser, [visits], hits, [downloads], authuser ] )
seen[key] = len( n
Vergos,
Please provide more information and show how you've debugged the code so
far...
On 25/02/19 7:03 AM, vergos.niko...@gmail.com wrote:
pymydb.execute( '''SELECT host, ref, location, useros, browser, visits, hits,
downloads, authuser FROM guests
pymydb.execute( '''SELECT host, ref, location, useros, browser, visits, hits,
downloads, authuser FROM guests
WHERE pagesID = (SELECT ID FROM pages
WHERE url = %s) ORDER BY visits DESC''', page )
data = pymydb.fetchall()
for visit in visits:
On 2018-08-18 16:43, Jason Friedman wrote:
$ python3
Python 3.6.1 (default, Apr 8 2017, 09:56:20)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
import collections, datetime
x = collectio
$ python3
Python 3.6.1 (default, Apr 8 2017, 09:56:20)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections, datetime
>>> x = collections.defaultdict(int)
>>>
1 - 100 of 950 matches
Mail list logo