lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]for i in range(0, len(lst), 5):print(lst[i:i+5], end='\n')
2. 使用计数器和`print`函数的组合:

count = 0for i in range(1, 11):print(i, end=' ')count += 1if count == 5:print()count = 0
3. 使用`for`循环和条件语句:
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]counter = 0for d in data:print(d, end=' ')counter += 1if counter == 5:print()counter = 0
以上代码示例展示了如何在Python中实现每行输出5个数后换行的功能。您可以根据需要选择合适的方法
