-1
1. first.py file
import logging
class Log:
def __init__(self,msg):
self.msg = msg
def debug(self,msg):
FORMAT = "%(asctime)-15s%(message)s"
logging.basicConfig(filemode = "w", filename="file.log", format = FORMAT, level=logging.DEBUG)
logging.debug(self.msg)
2. second.py file
import first
first.Log.debug("I am in debug mode")
**调用方法,当我运行second.py文件比我得到错误的 Logging.Log.debug(“我什么时候我在调试模式“)类型错误:调试()失踪1个人需要的位置参数:“味精”从不同类
TypeError: debug() missing 1 required positional argument: 'msg'**
请建议我在这里做错了什么,我是新来的编码。
的可能的复制[类型错误:缺少1个所需的位置参数: '自我'(http://stackoverflow.com/questions/17534345/typeerror-missing- 1-需要-位置参数的自身) – Somar