title: Iterating through multiple URLs from .txt file with Python/BeautifulSoup
body: <p>I'm trying to create a script that takes a .txt file with multiple lines of YouTube usernames, appends it to the YouTube user homepage URL, and crawls through to get profile data.</p>
  
  <p>The code below gives me the info I want for one user, but I have no idea where to start for importing and iterating through multiple URLs.</p>
  
  <pre><code>#!/usr/bin/env python
  # -- coding: utf-8 --
  from bs4 import BeautifulSoup
  import re
  import urllib2
  
  # download the page
  response = urllib2.urlopen("http://youtube.com/user/alxlvt")
  html = response.read()
  
  # create a beautiful soup object
  soup = BeautifulSoup(html)
  
  # find the profile info &amp; display it
  profileinfo = soup.findAll("div", { "class" : "user-profile-item" })
  for info in profileinfo:
      print info.get_text()
  </code></pre>
  
  <p>Does anyone have any recommendations?</p>
  
  <p>Eg., if I had a .txt file that read:</p>
  
  <pre><code>username1
  username2
  username3
  etc.
  </code></pre>
  
  <p>How could I go about iterating through those, appending them to <a href="http://youtube.com/user/%s" rel="nofollow">http://youtube.com/user/%s</a>, and creating a loop to pull all the info?</p>