title: python BeautifulSoup - can't set attribute, trying to replace a tags value
body: <p>Im trying to check if the span tag has the string '~', if it does I want to replace it with '0'.</p>
  
  <p>I've hundreds of span tags, I want to change the span.text value, as i want to copy the IF Statement to many places throughout my code, it wont work hard coding the var001 into the if statement. </p>
  
  <p>How can i do this?</p>
  
  <p>my code</p>
  
  <pre><code>span = soup.find("span", id="id001")
  if span.text in  ['~']:
      span.text = 0
  var001 = span.text
  </code></pre>
  
  <p>but this gives the error</p>
  
  <pre><code>AttributeError: can't set attribute
  </code></pre>