title: Python 3 - Reading line by line from a textfile and doing action for each line
body: <p>I need something like this done:</p>
  
  <ul>
  <li>Login to a website. </li>
  <li>Make an action to a specific URL.</li>
  <li>After the action, go to another URL (still in the site).</li>
  </ul>
  
  <p>So far here's what I've done.</p>
  
  <pre><code>if loginAccount(user, pass, url) == 1:
      if someActionChecking(url) == 1:
          None
      else:
          print ("[INFO]blablabla")
          actionNow(url, actionProcess)
  
      if someActionChecking(url2) == 1:
          None
      else:
          print ("[INFO]blablabla")
          actionNow(url2, actionProcess)
  
      if someActionChecking(url3) == 1:
          None
      else:
          print ("[INFO]blablabla")
          actionNow(url3, actionProcess)
  else:
      print ("Login failed.")
  </code></pre>
  
  <p>Now here's the <strong>problem</strong>:</p>
  
  <p>I want to shorten the code and make my life easier by just fetching the url's from a text file that contains <em>url1, url2, url3</em> (as an example), read the URL's stored there line by line, and loop the <strong>actionNow()</strong> function per line. So it will be something like this:</p>
  
  <pre><code>if loginAccount(user, pass, url) == 1:
      if someActionChecking(url) == 1:
          None
      else:
          #I need to loop this process below!!
          print ("[INFO]blablabla")
          actionNow(url, actionProcess)
  else:
      print ("Login failed.")
  </code></pre>
  
  <p>Any workaround for this? I am already searching for a couple of days now, and all I see was the <strong>strip()</strong> technique but I can't really understand how it works.</p>
  
  <p>Hope someone can guide me,</p>