命令组合.txt文件中的所有单词
Command combines all the words in the .txt file
我想做什么:我正在学习如何为我的 discord.py 机器人使用 append
和其他与文件相关的东西。以后用于保存代码的标签。
问题:我的文本文件没有按我预期的方式组织,如提供的图像所示。
字不分
期望,如其他多个教程和 'asks' 我已浏览
@client.command()
async def save(ctx, *, arg):
fn = "texttag.txt"
with open(fn, "a") as f:
f.write(arg)
await ctx.send(f"**{arg}** has been appended to `texttag.txt`")
return
你必须在每个字符串之后写一个换行符,然后再将其写入文件,如
string str = "abc" + "\n";
那就写吧。希望能解决问题
我想做什么:我正在学习如何为我的 discord.py 机器人使用 append
和其他与文件相关的东西。以后用于保存代码的标签。
问题:我的文本文件没有按我预期的方式组织,如提供的图像所示。
@client.command()
async def save(ctx, *, arg):
fn = "texttag.txt"
with open(fn, "a") as f:
f.write(arg)
await ctx.send(f"**{arg}** has been appended to `texttag.txt`")
return
你必须在每个字符串之后写一个换行符,然后再将其写入文件,如
string str = "abc" + "\n";
那就写吧。希望能解决问题