遇事不决,可问春风,春风不语,谨遵本心|

布都御魂

园龄:3年9个月粉丝:2关注:1

按要求数目分行

from math import ceil


def split_word(lst, size):
word_list = list(
map(lambda x: lst[x * size:x * size + size],
list(range(0, ceil(len(lst) / size)))))
words = ''
if size == 1:
for word in word_list:
words += word
else:
for word in word_list:
words += word + '\n'
return words

本文作者:布都御魂

本文链接:https://www.cnblogs.com/wolvies/p/16529293.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   布都御魂  阅读(17)  评论(0编辑  收藏  举报
历史上的今天:
2021-07-28 IndentationError: unindent does not match any outer indentation level
   
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起