下面这段程式中, 我预期会得到目前的日期加上字串In prtn_global_config.
可是执行后出现TypeError: prtn_global_config() missing 1 required positional argument: 'self'
error highlight处在最后一行prtn_global_config()
请教问题是出在哪里呢? 谢谢.
PS. 我使用Sublime, python 3.6.8
import logging
import sys
import random
import time
import datetime
def prtn_info(self, msg):
print(str(datetime.datetime.now()) + msg) #datetime.datetime.now():获取当前datetime
def prtn_global_config(self):
self.prtn_info('In prtn_global_config')
prtn_global_config()