"Alan Gauld" <[EMAIL PROTECTED]> wrote
questions(answered and unaswered). I copy the unanswered questions
and paste it in console: here a question is displayed in 5 rows,
and
I have 20 questions/page.
I'm beginning to suspect you really want something like
this pseudo code:
s = raw_input('Paste here> ')
for count, line in enumerate(s): pass
print "You have ", count/5," questions left in ", count/100," pages"
Had a rethink...
I don't know enough about how the X paste mechanism and the
console stdin work together but this may not work because
raw_input will probably stop reading at the first \n character.
You probably need to use sys.stdin.read:
print 'paste now'
s = sys.stdin.read()
count = s.split('\n) # no need for a loop.
print "You have ", count/5," questions left in ", count/100," pages"
Maybe...
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor