Message241206
| Author |
terry.reedy |
| Recipients |
Saimadhav.Heblikar, asvetlov, ggenellina, gpolo, mrabarnett, rhettinger, terry.reedy |
| Date |
2015年04月16日.08:09:52 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1429171792.74.0.798879494364.issue5680@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Pending application of a patch, the following will work to only add args to sys.argv when running from an Idle editor.
import sys
# ...
if __name__ == '__main__':
if 'idlelib.PyShell' in sys.modules:
sys.argv.extend(('a', '-2')) # add your argments here.
print(sys.argv) # in use, parse sys.argv after extending it
# ['C:\\Programs\\python34\\tem.py', 'a', '-2'] |
|