Hi,
I was wondering why this happens. I was trying to create a list of lists.
>>> d = [[]]
>>> d[0][0]=1
Traceback (most recent call last):
File "", line 1, in ?
IndexError: list assignment index out of range
>>> d
[[]]
What's wrong with that?
However:
>>> d[0].append(1)
>>> d
[[1]]
I guess I
"Moos Heintzen" wrote
>>> d = [[]]
>>> d[0][0]=1
IndexError: list assignment index out of range
>>> d[0].append(1)
>>> d
[[1]]
I guess I can't reference [0] on an empty list.
Thats right. You can't assign a value to a position in
a list that hasn't been created yet. It has nothing to
do w
Le Fri, 13 Feb 2009 15:41:01 +1300,
John Fouhy a écrit :
> 2009/2/13 Eric Dorsey :
> > Alan, can you give a short snippet of what that would look like? I was
> > trying to code out some idea of how you'd retain insertion order using
> > another dict or a list and didn't get anywhere.
>
> Here's
Dear Tutor,
I am preparing a data base saving it with pickle. I want to add additional
information to the data base but seem to to have to recover the whole file from
disc then add to it and save it again. Is there and append function within
Pickle that will add information to the end of an e
On Fri, Feb 13, 2009 at 5:37 AM, Philip Cooper wrote:
> Dear Tutor,
>
> I am preparing a data base saving it with pickle. I want to add additional
> information to the data base but seem to to have to recover the whole file
> from disc then add to it and save it again. Is there and append functi
On Thu, Feb 12, 2009 at 6:20 PM, Emad Nawfal (عماد نوفل)
wrote:
> Dear Tutors,
> I have syntax trees like the one below. I need to extract the membership
> information like which adjective belongs to which noun phrase, and so on. In
> short, I want to do something like this:
> http://ilk.uvt.nl/te
Hi everyone,
I copied a program from C to track multiple log files. I would like to
be able to print a label when a log file is updated. Here is the program;
#!/usr/bin/python
from threading import Thread
import subprocess
from Queue import Queue
num_threads = 3
queue = Queue()
logfiles = ["/
Pyparsing has a built-in helper called nestedExpr that fits neatly in with
this data. Here is the whole script:
from pyparsing import nestedExpr
syntax_tree = nestedExpr()
results = syntax_tree.parseString(st_data)
from pprint import pprint
pprint(results.asList())
Prints:
[[['S',
['NP-SB
Hello,
I am modifying a simple program "copy file" from the tutorials Alan
Gauld wrote. In it's first simpler instance (W/O date) it works
beautifully. But I wanted to
add the date the file was copied. I've kept it simple by pointing to
a single file.
The problem lies somewhere in how the
Moos Heintzen wrote:
Hi,
I was wondering why this happens. I was trying to create a list of lists.
>>> d = [[]]
>>> d[0][0]=1
Traceback (most recent call last):
File "", line 1, in ?
IndexError: list assignment index out of range
>>> d
[[]]
What's wrong with that?
However:
>>> d[0].append(1)
I want to be able to call a variable from one of my classes to my main class
(interface layout) and have it update every minute. I am using Python and
wxPython. Is it better to be in the main class and read the variable or
should I have the class the variable resides in to send the variable along
t
wrote
I am modifying a simple program "copy file" from the tutorials Alan
Gauld wrote. In it's first simpler instance (W/O date) it works
beautifully. But I wanted to
add the date the file was copied. I've kept it simple by pointing to
a single file.
The problem lies somewhere in how the progr
On Fri, Feb 13, 2009 at 11:01 AM, bob gailer wrote:
> Moos Heintzen wrote:
>
>> I guess I can't reference [0] on an empty list. (I come from a C
>> background.)
>>
> Can you have an empty array in C? If so, it does not have any elements, so
> you can't refer to element 0.
I think the OP was co
"Hi" wrote
I want to be able to call a variable from one of my classes to my
main class
(interface layout) and have it update every minute.
Sp provuide an update method in the class that has the variable.
Do not pass the variable to another class to update it, Objects
should always do it to
On Fri, Feb 13, 2009 at 11:11 AM, Alan Gauld wrote:
>
>> {\rtf1\mac\ansicpg1\cocoartf824\cocoasubrtf440
>>
>
> The problem is that this is an RTF format which is a binary format.
> You can process binary data ion Python (see the box on the files
> topic page) but it is much more difficult that
On Fri, Feb 13, 2009 at 11:35 AM, Marc Tompkins wrote:
> On Fri, Feb 13, 2009 at 11:11 AM, Alan Gauld wrote:
>
>>
>>> {\rtf1\mac\ansicpg1\cocoartf824\cocoasubrtf440
>>>
>>
Here's a quick-and-dirty way to do what (I think) you want to do:
Skip the first curly brace ("{") - find the next one.
I need some help.
I have written a filter called Peqibot that takes posts from Twitter
and makes them into wikipages on peqipedia.com
So if you post the following message on Twitter:
>@peqi Tallinn=The capital city of [[Estonia]].
It makes a page on peqipedia.com with "Tallinn" as the headline
Title: Signature.html
That's pretty much the question in Subject. I've got a date time
variable with, for example, 15:00:00 in hh:mm:ss format, and I'd like
to make it a string.
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N)
On Fri, Feb 13, 2009, Wayne Watson wrote:
>
> That's pretty much the question in Subject. I've got a date time
> variable with, for example, 15:00:00 in hh:mm:ss format, and I'd like
> to make it a string.
The easiest way is probably to use the strftime method available
on any datetime objec
On Fri, Feb 13, 2009 at 6:50 PM, Wayne Watson
wrote:
> That's pretty much the question in Subject. I've got a date time variable
> with, for example, 15:00:00 in hh:mm:ss format, and I'd like to make it a
> string.
Lots of choices:
In [1]: from datetime import datetime
In [2]: d=datetime.now()
In
On Fri, Feb 13, 2009 at 3:50 PM, Wayne Watson
wrote:
> That's pretty much the question in Subject. I've got a date time variable
> with, for example, 15:00:00 in hh:mm:ss format, and I'd like to make it a
> string.
>>> import datetime
>>> d = datetime.time(15,0)
datetime.time(15, 0)
>>> d
dateti
"Marc Tompkins" wrote
Here's a quick-and-dirty way to do what (I think) you want to do:
Skip the first curly brace ("{") - find the next one. Just before
it,
insert a space + the datestamp text. That's it.
If the OP is just working through my tutor I doubt if he will
be able to do much
"pa yo" wrote
The way I have come up with to solve this problem is to put the
following loop in:
rawfeed = feedparser(http//twitter.com/foobar)
feedstring = rawfeed.split('=',1)#this splits the feed at
the first "="
headline = feedstring[0]#this is the text
i
cclpia...@comcast.net wrote:
Hello,
"but can't open with the application TextEdit"
What are you doing to open it? What does "can't open" mean"? Error
messages or what?
Could this be a resource fork issue? AFAIK Python does not reproduce the
resource fork.
--
Bob Gailer
Chapel Hill NC
919-636-
Title: Signature.html
Well, let me try this again. I'm only interested in time. The user sees
a widget dialog that asks him to put the time in it in the format
HH:MM:YY, so he enters 15:30:10, or, as before 15:00:00. The value gets
back to the code I'm working in as 15:30:10 as the type in Subj
25 matches
Mail list logo