title: Read username and password from a file
body: <p>How can i read text, e.g., username and password from a file line-by-line in Python? For example, i can achieve this in shell/bash:</p>
  
  <pre><code>#!/bin/bash
  
  AUTH='/authentication/account.txt'
  U=$(sed -n 1p ${AUTH})
  P=$(sed -n 2p ${AUTH})
  </code></pre>
  
  <p>and inside the file /authentication/account.txt are my username and password line-by-line like this:</p>
  
  <pre><code>username
  userpass
  </code></pre>