0

I'm wondering how I could replace a especific text cited by a parentheses: (wordExample), a double comma "wordExample" or any other marker.

Here's a example:

  1. I would have a Example.doc file with the following text:

"Hello, this is just a dummy text written teo get Ethereums price: {cripto:ETH} dolars"

  1. My python script would find the DOC file localy and get all the variables needed to be replaced. As we have the example:

{cripto:ETH}

  1. Another script I have would find the variables asked for. Knowing it could haved asked for any set of cripto prices, like "cripto:BTC". Now I have the ETH's price and the following date.

  2. Now it should generate another DOC file replacing {cripto:ETH} with ETH's price and a screenshot of it's graph.

Thats it! I just want to know how I can get do that sistem of getting the DOC file and replacing some of it's elements dinamicaly

  • I must warn you, .doc files are a pain to work with. You would be better off using plaintext (.txt). – C_Z_ Jun 27 '22 at 17:02
  • To read and replace text, this question is a good place to start: https://stackoverflow.com/questions/17140886/how-to-search-and-replace-text-in-a-file You may need to look in regular expressions depending on your needs – C_Z_ Jun 27 '22 at 17:03

0 Answers0