title: Execute a command by reading contents of a text file
body: <p>I want to automate a Linux command using python.
  The command is:</p>
  
  <pre><code>smbmap -u robert -p p@ssw0rd -H 192.168.2.10
  </code></pre>
  
  <p>I have a wordlist which includes possible usernames in each line. How can I write a code which execute the command by reading the file? For example I have a list called "users.txt" which contains:</p>
  
  <pre><code>robert
  admin
  administrator
  guest
  </code></pre>
  
  <p>And it should try as follow till it finds the correct user&amp;password:</p>
  
  <pre><code>smbmap -u robert -p p@ssw0rd -H 192.168.2.10
  smbmap -u admin -p p@ssw0rd -H 192.168.2.10
  smbmap -u administrator -p p@ssw0rd -H 192.168.2.10
  smbmap -u guest -p p@ssw0rd -H 192.168.2.10
  </code></pre>
  
  <p>Thanks.</p>