试试这个:
>>> def print_sameline(): ... list = [1,2,3] ... print("List: ",end="") ... print(*list,sep=",") ... >>> print_sameline() List: 1,2,3