1. 定义一个print_lol函数来控制列表的缩进和写入位置 import sys """this is a new fuction, which work for a list""" def print_lol(the_list,indent=False,level=0,where=sys.stdout): """ one arguement is the_list""" for e…
1. Print them to screen man = [] other = [] try: data = open('sketch.txt') for each_line in data: try: (role, line_spoken) = each_line.split(':',1) line_spoken=line_spoken.strip() if role== 'Man': man.append(line_spoken) elif role == 'Other Man': oth…
python提供了一个日志处理的模块,那就是logging 导入logging模块使用以下命令: import logging logging模块的用法: 1.简单的将日志打印到屏幕上 import logging logging.debug("This is debug message") logging.info("This is info message") logging.warning("This is warning message"…