如何在第一个强制换行/换行?我不希望它是一个新段落(即行之间没有额外的空格),我只想让文本从一个新行开始.谢谢!
我正在使用ast模块来解析Python模块中的文档字符串,以将我们的文档转换为docs格式.我正在使用以下内容将函数名称和文档字符串放入我的其余代码可以很好地使用的dicts列表中.我正在寻找能够获得函数参数的东西:
good_file = (file for file in os.listdir() if file[-3:] == '.py' and file != '__init__.py')
functions = []
for file in good_file:
with open(file, 'r') as f:
module = ast.parse(f.read())
for node in module.body:
if isinstance(node, ast.FunctionDef):
entry = {"docs": ast.get_docstring(node), "fn_name": node.name, "params": ???}
functions.append(entry)
Run Code Online (Sandbox Code Playgroud)
我正在寻找可以用来将函数的参数填入dict的东西.谢谢!