亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在df列中的每個第n個字符后插入換行符

在df列中的每個第n個字符后插入換行符

慕絲7291255 2021-05-07 16:18:05
我想在df列中的每個單元格的每個第n個字符之后插入換行符(> br <)。我具有以下功能,但是不知道如何調整它以遍歷df列的每一行,而不僅僅是單個文本片段。任何幫助,將不勝感激。def insertNewlines(text, lineLength):    if len(text) <= lineLength:        return text    elif text[lineLength] != ' ':        return insertNewlines(text[:], lineLength + 1)    else:        return text[:lineLength] + '<br>' + insertNewlines(text[lineLength + 1:], lineLength)響應user2906838:我的數據包含在名為“消息”的df中,相關列為“消息”。我嘗試了您的代碼,但是它為該行生成了語法錯誤:row[key] = return insertNewlines(text[:], lineLength + 1)抱歉,由于您之前未發布數據,請在此處找到我的df樣本:Excerpts:Can this issue be closed?The other precedences are OK; as far as I can tell... not worth messing around in the code for no demonstrable benefit.we ran into this issue on our platform. it's possibly very specific to our setup; but the patch should cause no problems for any other setup as well. simplifying this into on line is of course possible. i can't really tell you any more about it; since this issue was fixed in our local implementation about one year ago by some colleague. in preparation for our migration to the current version of shindig and opensocial 0.9 i'm revising all patches and feature additions we did over the last year and will be looking at which are worth comitting. so you can expect some more small issues in the next weeks ;)Completely non-related and probably belongs in another jira _x0089_???’ but I've added a small patch to fix two comment typos in HttpTransact (I know authorized can be spelt with an s _x0089_???’ but we don't do that anywhere else in the code)Already fixed in UIMA-1379.
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 117 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號