How to apply a mask to a number or string in Python?
<p>I don't know if masks can only be applied to strings or numbers so I included both in my title (since I can always translate between the two later).</p>

<p>Let's say I have a mask <code>mask = '001001'</code> and I want to somehow say "for all positions in the mask that equal 1, apply X to those same positions in this other string".</p>

<p>For instance say I have a number 123456 and I apply that mask to it and want to set the digits to 0. I'd get 120450. </p>

<p>Apologies if I am not making sense. Please suggest an ideal mask type if my earlier string example is not the best, and an easy way to use it to apply changes to a separate number/string.</p>
