title: Insert square brackets around specific words within a text string in Python?
body: <p>I have a text string, and have identified a set of words which I want to wrap with []. I have stored these words in an array, and have also stored the index position of their first and last characters in each object as well.</p>
  <p>How can I append [] to either side of these words in Python?</p>
  <p>Here is an example of a text string I am extracting words from:
  <code>&quot;The SARs were leaked to the Buzzfeed website and shared with the International Consortium of Investigative Journalists (ICIJ). Panorama led the research for the BBC as part of a global probe. The ICIJ led the reporting of the Panama Papers and Paradise Papers leaks - secret files detailing the offshore activities of the wealthy and the famous. Fergus Shiel, from the consortium, said the FinCEN Files are an insight into what banks know about the vast flows of dirty money across the globe… [The] system that is meant to regulate the flows of tainted money is broken. The leaked SARs had been submitted to the US Financial Crimes Enforcement Network, or FinCEN between 2000 and 2017 and cover transactions worth about $2 trillion. FinCEN said the leak could impact US national security, risk investigations, and threaten the safety of those who file the reports. But last week it announced proposals to overhaul its anti-money laundering programmes. The UK also unveiled plans to reform its register of company information to clamp down on fraud and money laundering.The investment scam that HSBC was warned about was called WCM777. It led to the death of investor Reynaldo Pacheco, who was found under water on a wine estate in Napa, California, in April 2014. Police say he had been bludgeoned with rocks. He signed up to the scheme and was expected to recruit other investors. The promise was everyone would get rich. A woman Mr Pacheco, 44, introduced lost about $3,000. That led to the killing by men hired to kidnap him. He literally was trying to… make people's lives better, and he himself was scammed, and conned, and he unfortunately paid for it with his life,said Sgt Chris Pacheco (no relation), one of the officers who investigated the killing. Reynaldo, he said, was murdered for being a victim in a Ponzi scheme.&quot;</code></p>
  <p>Here is an example of what the array of words I am looking to append square brackets to looks like:</p>
  <p><code>[('Buzzfeed', 28, 36, 'ORG'), ('International Consortium of Investigative Journalists', 61, 118, 'ORG'), ('Panorama', 127, 135, 'ORG'), ('BBC', 161, 164, 'ORG'), ('Panama Papers', 222, 239, 'ORG'), ('Fergus Shiel', 346, 358, 'PERSON'), ('Files', 397, 402, 'PRODUCT'), ('US Financial Crimes Enforcement Network', 608, 651, 'ORG'), ('FinCEN', 733, 739, 'ORG'), ('US', 767, 769, 'GPE'), ('last week', 869, 878, 'DATE'), ('UK', 956, 958, 'GPE'), ('HSBC', 1094, 1098, 'ORG'), ('Reynaldo Pacheco', 1167, 1183, 'PERSON'), ('Napa', 1231, 1235, 'GPE'), ('California', 1237, 1247, 'GPE'), ('April 2014', 1252, 1262, 'DATE'), ('Mr Pacheco', 1431, 1441, 'PERSON'), ('44', 1443, 1445, 'DATE'), ('Sgt Chris Pacheco', 1677, 1694, 'PERSON')]</code></p>