parsing - Python Arguments not taking $ symbol, how to acheive this? -


python code test.py :

import sys username = str(sys.argv[1]) password = str(sys.argv[2]) print username, password 

execution #1 : python test.py usr@gmail.com pa$$word

result #1 : usr@gmail.com, pa24481word

expected #1 : usr@gmail.com, pa$$word


execution #2 : python test.py usr@gmail.com $word@pass

result #2 : usr@gmail.com, @pass

expected #2 : usr@gmail.com, $word@pass


i want pass available string in code.

machine details : python 2.6 on oel 6.6

if can solution generic across os - great!

this nothing python. shell interpreting value before passes script; $ in bash introduces environment variable.

you have surround parameter single quotes prevent this:

python test.py usr@gmail.com 'pa$$word' 

Comments