| The logic is so good so far. However, How do we move the (...) in |H
| to end of |R and before next |H

Maybe you are thinking too literally about the moving of the parenthetical item 
from the |H to the end of the |R.  Let's say you have the 3 chunks of 
information in variables h, f, and r:

###
>>> h='This (you see) is the header.'
>>> f='The Book'
>>> r='cool'
###

If you could break h apart into 3 pieces, the "This ", the "(you see)", and " 
is the header." and call them h1, h2, and h3 then you could add h1 and h3 back 
together (that's your new value of h) and add h2 to r as your new r:

###
>>> h1='This '
>>> h2='(you see)'
>>> h3=' is the header'
>>> h=h1+h3
>>> r=r+'\n'+h2  #the \n puts the parenthetical on a new line
>>> print h
This  is the header
>>> print r
cool
(you see)
###

(There's a double space left over at the place where the h1 and h3 were joined 
which is something you might want to fix before you add them back together. The 
string method ".strip() is nice for getting rid of leading and trailing space 
on a string. Here's an example:

###
>>> print s
   space before and after is gone      
>>> print s.strip()
space before and after is gone
###
)

What would help maintain the spirit of the tutor list is if you would ask 
specific questions about problems that you are having getting the script to do 
what you you want or clarifications about how something is suppose to work. 
Right now you have a task that is defined but you are asking general questions 
about designing the program, not specific questions about the *python* related 
problems. 

Rather than sending or posting the script you have, why not just post the 
specific problems you are running into? 

Thanks,
/c
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to