PROGRAM_MAX_LENGTH = 60*60*3 #3 hours
skiptimes = 0
TOTALTIMES = 0
def xxx():
print TOTALTIMES #fine consider it as constant
#TOTALTIMES += 1 #NOT OK
global TOTALTIMES
TOTALTIMES += 1 #OK
python sb 问题
时间: 2024-11-06 11:26:04
PROGRAM_MAX_LENGTH = 60*60*3 #3 hours
skiptimes = 0
TOTALTIMES = 0
def xxx():
print TOTALTIMES #fine consider it as constant
#TOTALTIMES += 1 #NOT OK
global TOTALTIMES
TOTALTIMES += 1 #OK
python sb 问题