On Tue, Mar 3, 2009 at 4:54 AM, Wayne Watson
wrote:
> What is this: d = [ int(x) for x in s.split(":") ]
> I see in the program I'm looking at, the [] construction can be much more
> complicated, as in:
> self.recent_events = [ event for event in self.recent_events
>
2009/3/3 Wayne Watson :
> What is this: d = [ int(x) for x in s.split(":") ]
It's a list comprehension:
http://docs.python.org/tutorial/datastructures.html#list-comprehensions
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
Title: Signature.html
What is this: d = [ int(x) for x in s.split(":") ]
I see in the program I'm looking at, the [] construction can be much
more complicated, as in:
self.recent_events = [ event for event in self.recent_events
if os.path.exists(event) and
Use time.strptime() to parse them into seconds since the start of epoch, and
then an ordinary numeric subtraction will work.
Cheers
On Monday 02 March 2009 19:45, Judith Flores wrote:
> Hello,
>
>I can't seem to figure out the syntax to calculate the difference in
> minutes between two time
2009/3/3 Judith Flores :
>
> Hello,
>
> I can't seem to figure out the syntax to calculate the difference in
> minutes between two time stamps. I already read the documentation about
> datetime and time modules, but I was unable to implement the code.
>
> My code will be fed with two timestamps
Hello,
I can't seem to figure out the syntax to calculate the difference in minutes
between two time stamps. I already read the documentation about datetime and
time modules, but I was unable to implement the code.
My code will be fed with two timestamps (as styrings):
start="09:35:23"
end
On Mon, Mar 2, 2009 at 5:36 PM, Network Administrator
wrote:
> I appreciate your explanation about the reserved word "list" as well as the
> code you gently wrote to me. Now, I want to show everybody what I did:
>
> #!/usr/bin/env python
> #
> # This function fills any given li
Thanks, Eric for your help!
I appreciate your explanation about the reserved word "list" as well as the
code you gently wrote to me. Now, I want to show everybody what I did:
#!/usr/bin/env python
#
# This function fills any given list
#
mylist = []
x = 0
while (x != 't2'):
"Daniele" wrote
have is how to adapt it to multiple plugins related to the same
interface.
There are a few approaches. There is a design pattern (facade
from memory) that allows this but you can also implement the
plugin calls as a list of objects.
So instead of calling
theInteface.foo
> -- Messaggio inoltrato --
> From: "Alan Gauld"
> To: tu...@python.org
> Subject: Re: [Tutor] Tutor Digest, Vol 61, Issue 3
>
> OK, To do that you need to provide an intrerface in your code
> that the plug-in can use. That is to say you must call a documented
> set of functions/me
Daniele wrote:
>> From: W W
>> Subject: Re: [Tutor] modular program
>
>>> Where can I find some "best practices" for writing modular programs?
>>> I thought about a txt file containing function calls that my program will
>>> parse and execute in order, or is it better just to execute every .py fi
11 matches
Mail list logo