# An absurd workaround for the lack of arithmetic in MS's resource compiler.# After building Python, run this, then paste the output into the appropriate# part of PC\python_nt.rc.# Example output:## * For 2.3a0,# * PY_MICRO_VERSION = 0# * PY_RELEASE_LEVEL = 'alpha' = 0xA# * PY_RELEASE_SERIAL = 1# *# * and 0*1000 + 10*10 + 1 = 101.# */# #define FIELD3 101import sysmajor, minor, micro, level, serial = sys.version_infolevelnum = {'alpha': 0xA,'beta': 0xB,'candidate': 0xC,'final': 0xF,}[level]string = sys.version.split()[0] # like '2.3a0'print(" * For %s," % string)print(" * PY_MICRO_VERSION = %d" % micro)print(" * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)))print(" * PY_RELEASE_SERIAL = %d" % serial)print(" *")field3 = micro * 1000 + levelnum * 10 + serialprint(" * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3))print(" */")print("#define FIELD3", field3)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。