Valone, Toren W. wrote:
I need to know how to read the next line while in the "for line in" loop.
Readline does not read the next line (I watched it in debug) I think it has
something to do with the for line loop but I have not found any
documentation in the doc's or tutor for any functions for lin
Kent Johnson wrote:
I would use a central dispatcher. Each chapter function could return a
token indicating which chapter is next, or it could return the actual
next chapter function.
Look here for an *extensive* example of this style:
http://homepage.mac.com/spkane/python/paranoia.py
Kent
__
I'm seeing it used in a Python/Applescript tutorial, though am unclear
on it's exact purpose or usage. Can someone fill me in?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
> Remember that I am generating cars even while the
> simulation is running, hence calculating this HCF at
> the beginning is not going to work.
> Any comments?
This won't help you much in writing your program, but you might find
it interesting and vaguely similar to what you're doing:
www.simut
I have run into a problem again.
I thought about simulation time concurrency and
figured an inherent problem with the approach.
The main objective of my project is to simulate
traffic behavious under congested conditions.Hence I
was using semaphores to lock the areas already
occupied by the cars.A
> > I am reading ' Learning Python second edition' by Mark Lutz and David
> > Ascher, and I trying the code examples as I go along. However I am
> > having a problem with the following, which I don't seem to be able to
> > resolve :-
> > # test.py
> > import sys
> >
> > print sys[ 1: ]
> >
> > T
Remember computers count from 0, so sys[1] is the 2nd argument, sys[0]
is always the filename.
On Fri, 25 Feb 2005 22:33:50 -0500, Jay Loden <[EMAIL PROTECTED]> wrote:
> Should be:
>
> import sys
>
> def main():
> '''prints out the first command line argument'''
> print sys.argv[1]
>
> main
Valone, Toren W. wrote on Fri, 25 Feb 2005 14:14:59 -0800:
> I need to know how to read the next line while in the "for line in" loop.
If you want to skip some of the lines (whatever their source may be), I
think you should *not* use a for..in loop, but a while loop, in which you
read/skip lines
You want readlines() not readline() and it should work something like this:
remailfile = open("remail2.txt", r)
remails = remailfile.readlines()
for line in remails:
#do something
-Jay
On Friday 25 February 2005 05:14 pm, Valone, Toren W. wrote:
> I need to know how to read the next line whil
Should be:
import sys
def main():
'''prints out the first command line argument'''
print sys.argv[1]
main()
On Friday 25 February 2005 04:35 pm, Richard gelling wrote:
> Hi,
>
> I am reading ' Learning Python second edition' by Mark Lutz and David
> Ascher, and I trying the code examples
I need to know how to read the next line while in the "for line in" loop.
Readline does not read the next line (I watched it in debug) I think it has
something to do with the for line loop but I have not found any
documentation in the doc's or tutor for any functions for line..
Thanks, please forg
Hi,
I am reading ' Learning Python second edition' by Mark Lutz and David
Ascher, and I trying the code examples as I go along. However I am
having a problem with the following, which I don't seem to be able to
resolve :-
# test.py
import sys
print sys[ 1: ]
This I believe is supposed to prin
Luke Jordan wrote on Fri, 25 Feb 2005 11:04:11 -0800:
Hi Luke,
> I'm working on a command-line game. Is there anything wrong with
> having each 'chapter' of the game be a function that links to other
> chapters by calling them? I only ask because when a recent traceback
> returned about 40 lines
Luke Jordan wrote:
Hi -
I'm working on a command-line game. Is there anything wrong with
having each 'chapter' of the game be a function that links to other
chapters by calling them? I only ask because when a recent traceback
returned about 40 lines worth of error message, I realized that the
fun
Luke,
On Fri, 25 Feb 2005 11:04:11 -0800, Luke Jordan <[EMAIL PROTECTED]> wrote:
> Hi -
>
> I'm working on a command-line game. Is there anything wrong with
> having each 'chapter' of the game be a function that links to other
> chapters by calling them? I only ask because when a recent tracebac
Hi -
I'm working on a command-line game. Is there anything wrong with
having each 'chapter' of the game be a function that links to other
chapters by calling them? I only ask because when a recent traceback
returned about 40 lines worth of error message, I realized that the
functions are all bein
If what you want is something that scales up, then you're attacking
the Wrong Problem. Rather than focus on getting your thread overhead
as small as possible in order to support as much real-time concurrency
as you can, you should (as has been suggested) try to get
simulation-time concurrency with
Hi Hugo,
> I tried my hands at Stackless too... but still had
> problems implementing the concept.
>
> Can anyone guide me on how to spawn simultaneously( or
> pseudo simultaneously) running microthreads using
> stackless.
>
> Here is what i tried..
>
> ef gencars(num,origin,dest,speed):
>
Hi,
Thanx everyone for all your suggestions.I used a
separate thread for every car as I wanted my cars to
run in real time, to coordinate effectively with other
systems like traffic lights for eg. which I cant edit,
hence which cant use the variable time defined by me.
I figured out two ways to ac
Liam Clarke wrote:
Hi,
Well thanks Kent, after a bit of puzzlement I feel like I'm getting it.
Pysqlite takes care of correct quotation marks for me, but it's only
good for parameters.
Right, you still hard-code the rest of the query.
so to generate 'select * from foo if A = "Bat"' I can hand cx
Hi,
Well thanks Kent, after a bit of puzzlement I feel like I'm getting it.
Pysqlite takes care of correct quotation marks for me, but it's only
good for parameters.
so to generate 'select * from foo if A = "Bat"' I can hand cx.execute
'Bat', but I still have to
insert A.
So, my select statem
A light dawns, and I now understand how SQL code injection attacks can happen.
Looks like I'm going to have to rethink & re-examine some docs
Cheers,
Liam
On Fri, 25 Feb 2005 06:15:05 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Liam Clarke wrote:
> > Hi,
> >
> > Hope I don't annoy an
On Fri, 25 Feb 2005 20:19:15 +1300
Liam Clarke <[EMAIL PROTECTED]> wrote:
> >
> > for i in range(0,10):
> > print i
> > buttonlabel = "field " +str(i)
> > button[i].append = Button (text=buttonl
Liam Clarke wrote:
Hi,
Hope I don't annoy anyone by asking this here, if I do, let me know.
When you're doing a SQL select statement, what would be better? Say
you're searching by name, should I do -
j = cx.execute
j('select * from foo where first == %s and last == %s') % (a,b)
q = cx.fetchall(
Adam Cripps wrote:
button = []
for i in range(0,10):
print i
buttonlabel = "field " +str(i)
button[i].append = Button (text=buttonlabel)
button[i].grid(column=3, row = i+3
Hi,
Hope I don't annoy anyone by asking this here, if I do, let me know.
When you're doing a SQL select statement, what would be better? Say
you're searching by name, should I do -
j = cx.execute
j('select * from foo where first == %s and last == %s') % (a,b)
q = cx.fetchall()
if not q:
j(
*click* Oh yeah. What you said. Oops. :\
Liam
On Fri, 25 Feb 2005 05:53:54 -0200, Ismael Garrido
<[EMAIL PROTECTED]> wrote:
> Sent only to Liam... Forwading..
>
> Original Message
> Subject:Re: [Tutor] Recursive Tkinter buttons
> Date: Fri, 25 Feb 2005 05:45:00 -0200
Ismael Garrido wrote:
Sean Perry wrote:
yep. call 'Parent.__init__(this, that)' then do 'self.new = new'
def __init__(self, this, that, new):
Parent.__init__(this, that)
self.new = new
Thanks.
Though it should be:
def __init__(self, this, that, new):
Parent.__init__(self, this, that) #
28 matches
Mail list logo