def deal_with_empty_file_stream(data):
"""???????????0???????????"""
if hasattr(data, 'fileno') and hasattr(data, 'tell'):
try:
fileno = data.fileno()
total_length = os.fstat(fileno).st_size
current_position = data.tell()
if total_length - current_position == 0:
return ""
except io.UnsupportedOperation:
return ""
return data
评论列表
文章目录