检索Python解释器的命令行参数

检索Python解释器的命令行参数,第1张

检索Python解释器的命令行参数

您可以使用ctypes

~$ python2 -B -R -uPython 2.7.9 (default, Dec 11 2014, 04:42:00) [GCC 4.9.2] on linux2Type "help", "copyright", "credits" or "license" for more information.Persistent session history and tab completion are enabled.>>> import ctypes>>> argv = ctypes.POINTER(ctypes.c_char_p)()>>> argc = ctypes.c_int()>>> ctypes.pythonapi.Py_GetArgcArgv(ctypes.byref(argc), ctypes.byref(argv))1227013240>>> argc.value4>>> argv[0]'python2'>>> argv[1]'-B'>>> argv[2]'-R'>>> argv[3]'-u'


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5662720.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存