草庐IT

PYTHONUNBUFFERED

全部标签

k8s pod log日志不显示python print打印的内容

问题Python程序代码中使用print()打印的内容,在查询k8spod日志时不显示。原因print()函数Python的print()函数签名如下:print(*objects,sep='',end='\n',file=None,flush=False)摘录部分官方文档如下:Thefileargumentmustbeanobjectwithawrite(string)method;ifitisnotpresentorNone,sys.stdoutwillbeused.Sinceprintedargumentsareconvertedtotextstrings,print()cannotbe

k8s pod log日志不显示python print打印的内容

问题Python程序代码中使用print()打印的内容,在查询k8spod日志时不显示。原因print()函数Python的print()函数签名如下:print(*objects,sep='',end='\n',file=None,flush=False)摘录部分官方文档如下:Thefileargumentmustbeanobjectwithawrite(string)method;ifitisnotpresentorNone,sys.stdoutwillbeused.Sinceprintedargumentsareconvertedtotextstrings,print()cannotbe