Python issue when using line.replace() with space : <p>I am currently working on a few lines where i want to replace symbol semicolon ";" with symbol "]". I am using line.replace(";","]"). Somehow i find that it is not working when the location of the semicolon is not consistent in a line.</p>

<p>Example:</p>

<pre><code>input add_clk; #this one works where the output will be input add_clk]
</code></pre>

<p>However, it is not working for line below:</p>

<pre><code>input sub_clk ; #tnothing change to the output, input sub_clk
</code></pre>

<p>The line that i used in my script is:</p>

<pre><code>if ";" in line:
    line = line.replace(";","]")
</code></pre>

<p>Somehow i figured out that this problem may due to a space before the semicolon. Is there anyway the script can ignore the space so that the output will be input sub_clk] ?</p>
