TextIOWrapper解决方案
TextIOWrapper本人python新手。。,在写import sys def print_lol(the_list,indentFalse,level0,fhsys.std
TextIOWrapper
本人python新手。。,在写
import sys
def print_lol(the_list,indent=False,level=0,fh=sys.stdout):
for each_item in the_list:
if isinstance(each_item,list):
print(each_item,indent,level+1,fh)
else:
if indent:
for tabs in range(level):
print('\t',end=' ',file=fh)
print(each_item,fh)
print_lol(['dasdf',['sdfa','fsdf']])
运行出来显示
ecil@cecil-Aspire-4750:~/nestCecil$ python nestCecil.py
dasdf <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
['sdfa', 'fsdf'] False 1 <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
求解释,谢谢啦
[解决办法]解析什么?该显示的都显示了
sys.stdout 默认就是文本流对象