[Tutor] paste question

cuciferus at gmail.com cuciferus at gmail.com
Sun Sep 28 09:45:59 CEST 2008

On Saturday 27 September 2008 22:27:56 Alan Gauld wrote:
> <cuciferus at gmail.com> wrote
> Sorry but I'm confused.
> > I made a little script to whom I wish to pass some pasted(with
> > middle
> > click(x11 style)) multi-row text. But if I pass say 99 rows it
> > crashes with no
> > error it exits to bash. Any ideas why?
> Do you mean you are trying to paste a long piece of text into the
> raw_input prompt?
> Otherwise I'm not sure what the code below has to do with anything?
> > from sys import exit
> you don;t use exit...
Sorry I was embarased with my exit function hence I have not pasted it in the 
> > a=0
> > while True:
> This will loop forever (or until an error) since you have no break
> statement.
> >    s=raw_input()
> >    a+=1
> >    if s=="finish":
> >        print "you have  ",  ((a-1)/5), " questions left"
> You might be wanting to use the % mod operator here instead
> of division? Otherwise it will always report a low value. And 'a'
> records how many responses have been given not how many
> questions are left.
> >        print "in", ((a-1)/100), " pages"
> Similarly a has nothing to do with pages... It looks like you
> need more variables, or something!
> >        a=0
> This does't make much sense to me either.
I'm good here. You see I'm doing some online tests for my graduation 
exam(don't know what is the equivalent in English), and in a test are hundreds 
of questions(I would give the site but it's in Romanian and requiers 
registration). The thing is it doesn't display the number of questions left 
unanswered, But it displays the status of questions(answered and unaswered). I 
copy the unanswered questions and paste it in console: here a question is 
displayed in 5 rows, and yeah you guessed I have 20 questions/page.

In bash I was doing it with echo "paste here"|wc-l and worked but when I paste 
in python shell a large amount of text it exits.
> But mostly I'm confused about what exactly you are doing with
> the paste and when.
> Assuming it is at the raw_input stage you could try printing
> s just to see what was read. That way when it exists you
> should still see what was last input.
> HTH,
Hope I was more clear this time

More information about the Tutor mailing list