title: How can it be done to replace a considerable string in which I know how it starts and ends in PYTHON?
body: <p>Good afternoon, I have a query, I have an answer that I receive after executing an SSH connection to a server, the question is that I need to eliminate a considerable substring from the response, so I would like to know if I am successful in some method that allows the Connecting fewer lines, for example, the <a href="https://www.geeksforgeeks.org/python-string-replace/" rel="nofollow noreferrer">replace</a> method is not effective for me, since as indicated in the image below, the replacement text is considerable.</p>
  
  <p>The beginning / end of the chain that I am going to replace I know, so that would be the limits to replace</p>
  
  <p>buff_string:</p>
  
  <p><a href="https://i.stack.imgur.com/ERwa2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ERwa2.png" alt="enter image description here"></a></p>
  
  <p>I must remove everything that is highlighted</p>
  
  <pre><code>...... code.....
  
  shell.close() #Cerramos canal
  ssh.close() #Cerramos cliente SSH
  # print(val_count)
  # print(buff_config.count('*B:P79COL01#'))
  print(buff_string)
  </code></pre>
  
  <p>See the following link <a href="https://stackoverflow.com/questions/26112171/how-to-remove-substring-from-a-string-in-python">How to remove substring from a string in python?</a> to document me, but the reality in the response is about removing chain of short substring, the opposite of my case</p>