title: Parsing text file and storing it in a list
body: <p>I am having a file discount.txt that contain data in following format:</p>
  
  <pre><code>Less than $100 --&gt; 0%
  From $100 up to less than $500 --&gt; 10%
  From $500 up to less than $1,000 --&gt; $40 PLUS 20%
  From $1,000 up to less than $2,000 --&gt; $140 PLUS 30%
  $2,000 and above --&gt; $440 PLUS 40%
  </code></pre>
  
  <p>It means Discount on the sale amount</p>
  
  <pre><code>Less than $100  0%
  From $100 up to less than $500  10% for each dollar over $100
  From $500 up to less than $1,000    $40 PLUS 20% of the total sale amount over $500
  From $1,000 up to less than $2,000  $140 PLUS 30% of the total sale amount over $1,000
  $2,000 and above    $440 PLUS 40% of the total sale amount over $2,000
  </code></pre>
  
  <p>That is, if the total sale amount is $100 then the discount will be $0. However, if the total sale amount is $101 then the discount will be $0.10. If the total sale amount is $500 then the discount will be $40, but if the total sale amount is $501 then the discount will be $40.20.</p>
  
  <p>So to solve this , what I think is to have 4 lists : 1 list for storing lower limit of sale amount, one for upper limit, one for holding fixed increment corresponding to a range and one for holding additional discount. If there is no fixed increment then assume it zero.</p>
  
  <p>Then for given sales amount if it lies in ith range then just do something like :</p>
  
  <pre><code>fixedIncrement[i] + (saleAmount-lowerLimit[i])*additionDiscount[i]
  </code></pre>
  
  <p>But problem am facing is parsing the given text file. Can someone please help to parse it and store it in lists in python</p>
  
  <p>Here in given file the lists would be something like this :</p>
  
  <pre><code>lowerLimit[] = [1,100,500,1000,2000]
  upperLimit[] = [100,500,1000,2000,MAX]
  fixedIncrement[] = [0,0,40,140,440]
  additionDiscount[] = [0,0.1,0.2,0.3,0.4]
  </code></pre>