from io import StringIO
L = eval(input())
def printL(lst,sep = ","):
s = StringIO()
print(*L,sep = sep,file = s)
value = s.getvalue()
s.close()
return value
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) #line1
你代码中:
def printL(lst,sep = ","): #line2
s = StringIO()
print(*L,sep = sep,file = s) #前一个sep对应print函数的参数;后一个见#line2中的自定义函数的参数
打印多个值时的分割符
print('hey','hi','hello', sep='_')
print('hey','hi','hello', sep='\t')
print('hey','hi','hello', sep='\n')
分割内容