首页 > 解决方案 > Python根据特定模式在另一行下添加行

问题描述

我创建了一个小 Python 程序来向我的手机发送短信,这样我就可以访问 HTML 网页而无需花费太多钱。它解析代码并将其拆分为多个文本文件(例如:split_file_aa)上的 160 个字符的块,这些名称存储在一个列表中,并通过“while”循环存储例如“split_file_aa”和'split_file_ab' 在一个名为 'smstext' 的变量中,一次一个。
所以这是我的问题:我在 NodeJS 中有一个包含常量(例如:)的程序const message = "__init__",就像在这个例子中一样:

// Some JS content above
const message = 'init'

我想要做的是每次执行'while'循环时在文件中添加'smstext'的内容,以const message2 = '<html code here>'const message3 = '<html code here>'等等的形式,等等,所以我之后的代码可能是

// Some JS content above
const message = 'init'
const message2 = '<html code here>'
const message3 = '<another bunch of html here>'

等等。

如果您有任何问题(因为我不确定我是否真的解释了我的问题),请随时提问!

谢谢!

标签: pythonnode.js

解决方案


推荐阅读