title: How can I do multiple substitutions using regex?
body: <p>I can use this code below to create a new file with the substitution of <code>a</code> with <code>aa</code> using regular expressions.</p>
  
  <pre><code>import re
  
  with open("notes.txt") as text:
      new_text = re.sub("a", "aa", text.read())
      with open("notes2.txt", "w") as result:
          result.write(new_text)
  </code></pre>
  
  <p>I was wondering do I have to use this line, <code>new_text = re.sub("a", "aa", text.read())</code>, multiple times but substitute the string for others letters that I want to change in order to change more than one letter in my text? </p>
  
  <p>That is, so <code>a</code>--><code>aa</code>,<code>b</code>--> <code>bb</code> and <code>c</code>--> <code>cc</code>. </p>
  
  <p>So I have to write that line for all the letters I want to change or is there an easier way. Perhaps to create a "dictionary" of translations. Should I put those letters into an array? I'm not sure how to call on them if I do. </p>