How do I modify the sys.argv[1] value...?

Asked 2 years ago, Updated 2 years ago, 95 views

import sys

sys.argv[1] = a

print(sys.argv[1])

Why does a not come out but a different value...?

sys

2022-09-21 21:25

1 Answers

It works well.

In [1]: import sys

In [2]: sys.argv[0]
Out[2]: '/home/allinux/workspace/lang/py36/bin/ipython'

In [3]: sys.argv[1]
Out[3]: '-i'

In [4]: sys.argv[1] = 'aaaaaaa'

In [5]: sys.argv[1]
Out[5]: 'aaaaaaa'


2022-09-21 21:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.