I have a python program which needs to be executed on both windows and linux. In windows alone it is automatically appending single quotes '' to the arguments. I'm using argparser to pass the arguments. Below is my code: test.py:
def test_func():
pass1 =args.testpassword
user =args.testuser
print(pass1)
print(user)
print('{}@{}'.format(user, pass1))
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--user", required=True, dest='testuser')
parser.add_argument("--password", required=True, dest='testpassword')
args = parser.parse_args()
test_func(args)
test.py --user 'testuser' --password 'testpass'
Output is: 'testuser'
'testpass'
'testuser'@'testpass'
the same script when executed in linux doesn't append the quotes and the output is:
testuser
testpass
testuser@testpass
In both cases i'm running on python-2.7.11 but not sure why in windows alone i'm getting these quotes. This is causing problem as my other module where i pass these values are expecting it without quotes. I even tried encoding the string using UTF-8 and it still didn't help. What am I doing incorrectly?