IamIan a écrit :
> I am using the suggested approach to make a years list:
>
> years = ["199%s" % x for x in range(0,10)]
> years += ["200%s" % x for x in range(0,10)]
>
> I haven't had any luck doing this in one line though. Is it possible?
# Q, D and pretty obvious
years = ["199%s" % x for x i
IamIan <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Thank you again for the great suggestions. I have one final
> question about creating a httpMonths dictionary like {'Jan':'01'
> , 'Feb':'02' , etc} with a minimal amount of typing. My code
> follows (using Python 2.3.4):
>
> import c
Thank you again for the great suggestions. I have one final question
about creating a httpMonths dictionary like {'Jan':'01' , 'Feb':'02' ,
etc} with a minimal amount of typing. My code follows (using Python
2.3.4):
import calendar
# Create years list, formatting as strings
years = map(str, xrang
On Wed, 18 Apr 2007 12:16:12 -0700, IamIan wrote:
> I am using the suggested approach to make a years list:
>
> years = ["199%s" % x for x in range(0,10)]
> years += ["200%s" % x for x in range(0,10)]
>
> I haven't had any luck doing this in one line though. Is it possible?
years = ["199%s" % x
In <[EMAIL PROTECTED]>, IamIan wrote:
> years = ["199%s" % x for x in range(0,10)]
> years += ["200%s" % x for x in range(0,10)]
>
> I haven't had any luck doing this in one line though. Is it possible?
In [48]: years = map(str, xrange(1999, 2011))
In [49]: years
Out[49]:
['1999',
'2000',
'20
On Wednesday, Apr 18th 2007 at 12:16 -0700, quoth IamIan:
=>I am using the suggested approach to make a years list:
=>
=>years = ["199%s" % x for x in range(0,10)]
=>years += ["200%s" % x for x in range(0,10)]
=>
=>I haven't had any luck doing this in one line though. Is it possible?
I'm so green
I am using the suggested approach to make a years list:
years = ["199%s" % x for x in range(0,10)]
years += ["200%s" % x for x in range(0,10)]
I haven't had any luck doing this in one line though. Is it possible?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 11, 7:28 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> On Apr 11, 7:01 pm, "7stud" <[EMAIL PROTECTED]> wrote:
>
> > On Apr 11, 2:57 pm, Bruno Desthuilliers
>
> > <[EMAIL PROTECTED]> wrote:
> > > IamIan a écrit :
>
> > > yearTotals = dict([(year, dict.fromkeys(months, 0)) for year in years])
>
> >
On Apr 11, 7:01 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> On Apr 11, 2:57 pm, Bruno Desthuilliers
>
> <[EMAIL PROTECTED]> wrote:
> > IamIan a écrit :
>
> > yearTotals = dict([(year, dict.fromkeys(months, 0)) for year in years])
>
> > HTH
>
> List comprehensions without a list? What? Where? How?
Oo
On Apr 11, 2:57 pm, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> IamIan a écrit :
>
> yearTotals = dict([(year, dict.fromkeys(months, 0)) for year in years])
>
> HTH
List comprehensions without a list? What? Where? How?
--
http://mail.python.org/mailman/listinfo/python-list
Thank you everyone for the helpful replies. Some of the solutions were
new to me, but the script now runs successfully. I'm still learning to
ride the snake but I love this language!
Ian
--
http://mail.python.org/mailman/listinfo/python-list
IamIan wrote:
> Hello,
>
> I'm writing a simple FTP log parser that sums file sizes as it runs. I
> have a yearTotals dictionary with year keys and the monthTotals
> dictionary as its values. The monthTotals dictionary has month keys
> and file size values. The script works except the results are
1) You have this setup:
logMonths = {"Jan":"01", "Feb":"02",...}
yearTotals = {
"2005":{"01":0, "02":0, }
"2006":
"2007":
}
Then when you get a value such as "Jan", you look up the "Jan" in the
logMonths dictionary to get "01". Then you use "01" and the ye
IamIan a écrit :
> Hello,
>
> I'm writing a simple FTP log parser that sums file sizes as it runs. I
> have a yearTotals dictionary with year keys and the monthTotals
> dictionary as its values. The monthTotals dictionary has month keys
> and file size values. The script works except the results a
"IamIan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Hello,
|
| I'm writing a simple FTP log parser that sums file sizes as it runs. I
| have a yearTotals dictionary with year keys and the monthTotals
| dictionary as its values. The monthTotals dictionary has month keys
| and fi
En Wed, 11 Apr 2007 15:57:56 -0300, IamIan <[EMAIL PROTECTED]> escribió:
> I'm writing a simple FTP log parser that sums file sizes as it runs. I
> have a yearTotals dictionary with year keys and the monthTotals
> dictionary as its values. The monthTotals dictionary has month keys
> and file size
Hello,
I'm writing a simple FTP log parser that sums file sizes as it runs. I
have a yearTotals dictionary with year keys and the monthTotals
dictionary as its values. The monthTotals dictionary has month keys
and file size values. The script works except the results are written
for all years, rat
17 matches
Mail list logo