我使用从网站数据刮掉,使我的机器人在显示单独的行。有一个特定的字符串,其信息具有“\ n”个之间,我想转换成那些实际换行符
我曾试图与“+‘\ n’+”代替“\ n”,但输出仍然是相同的
这是我有问题的例子,而不是实际的机器人代码
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
Client = discord.Client()
client = commands.Bot(command_prefix = "!")
cardName = "Card Name"
rawCardText = "This is an ability\nThis is another ability"
cardText = rawCardText.replace('\n', '+ "\n" +')
fullText = cardName + "\n" + cardText
await client.send_message (message.channel, fullText)
我希望是这样的:
持卡人姓名
这是一种能力
这是另一种能力
相反,我得到的是:
持卡人姓名
这是一种能力\ n这是另一种能力