title: in python, what should I add to fetch URLs form my (text file) or my (xml file) which include list of URLs?
body: <p>I have this code which is all work fine with (one link )
  Result of the code store values (availableOffers,otherpricess,currentprice,page_url) in (prices.csv) file  </p>
  
  <p>my problems are : <strong>First</strong> : I do not know what to write to fetch URLs form my (text file) or my (xml file) instead of one URL in this code </p>
  
  <pre><code>from bs4 import BeautifulSoup as soup  
  from urllib.request import urlopen as uReq  
  
  page_url = "XXXXXXXXX"
  
  
  uClient = uReq(page_url)
  page_soup = soup(uClient.read(), "html.parser")
  uClient.close()
  
  
  availableOffers = page_soup.find("input", {"id": "availableOffers"})["value"]
  otherpricess = page_soup.find("span", {"class": "price"}).text.replace("$", "")
  currentprice = page_soup.find("div", {"class": "is"}).text.strip().replace("$", "")
  
  
  out_filename = "prices.csv"
  headers = "availableOffers,otherpricess,currentprice,page_url \n"
  
  f = open(out_filename, "w")
  f.write(headers)
  
  
  f.write(availableOffers + ", " + otherpricess + ", " + currentprice + ", " + page_url + "\n")
  
  f.close()  
  </code></pre>
  
  <p><strong>Second problem</strong> : when URL do not have value for (otherpricess ) I get this error</p>
  
  <pre><code>line 13, in &lt;module&gt; 
  otherpricess = page_soup.find("span", {"class": "price"}).text.replace("$", "")
  AttributeError: 'NoneType' object has no attribute 'text'
  </code></pre>
  
  <p>how I bypass this error and tell the code to work even there are a value missing</p>
  
  <p><strong>thanks</strong> </p>