Python 关键字 -- global
MarshioLess than 1 minutepython
key wordsopen in new window
current_date = datetime.datetime.now().strftime('%Y-%m-%d')
def a():
global current_date
current_date = '2024-09-05'
if __name__ == '__main__':
print(current_date)
a()
print(current_date)