python function parameters that include symbols
<p>I wrote a python script as below</p>

<pre><code>def single_value(account,key):

        file = open('%s.txt'%account)
        file.write('Hello')
        file.close()
        file2 =  open('%s.txt'%key)
        file2.write('hoiiii')
        file2.close()
single_value(accountname, 2345kwjhf53825==)
</code></pre>

<p>when I execute the script I am getting error invalid syntax. I think it is because of '==' in key. Is there is a way to define this key. 
Please help </p>

<p>The invalid syntax error is because strings must be in quotes.  Thus, replace:</p>

<pre><code>single_value(accountname, 2345kwjhf53825==)
</code></pre>

<p>With:</p>

<pre><code>single_value('accountname', '2345kwjhf53825==')
</code></pre>

<p>The next error is that the files are opened read-only and you want to write to them.  All together:</p>

<pre><code>def single_value(account,key):

    with open('%s.txt'%account, 'w') as file:
        file.write('Hello')
    with open('%s.txt'%key, 'w') as file2:
        file2.write('hoiiii')

single_value('accountname', '2345kwjhf53825==')
</code></pre>

python python-3.x