Advertisement
Guest User

Parser for conf.t

a guest
Apr 11th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. # A sample text parser which operates on conf.t
  2. # Author : Shubham Somani
  3.  
  4. def return_parameters():
  5.     contents=open("conf.t")
  6.     list=[]
  7.     flag=0
  8.     for word in contents:
  9.         if "@subsection" in word:              
  10.             s=word.split("@subsection")
  11.             #print s[1].strip()
  12.             if flag==1:
  13.                 list.append("end of subsection")
  14.             list.append(s[1].strip())
  15.             flag=1
  16.         if "@findex" in word and flag==1:
  17.             s=word.split("@findex")
  18.             #print s[1].strip()
  19.             list.append(s[1].strip())
  20.     print list
  21.  
  22. return_parameters()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement