How to pass argument with exclamation mark on Linux?
As mentioned by others, this issue isn't specific to Python, but is caused by how you're passing the password parameter to the script.
You'll want to wrap the password string in single quotes to make sure that it's passed to the script exactly as you type it, and isn't interpreted by the shell.
You could do this for the username too, if there's the possibility that it includes an exclamation mark, or other special character.
For example:
emailsender.py -u 'username' -p 'pass!!'