【发布时间】:2021-08-16 23:34:35
【问题描述】:
我正在编写一个不和谐的机器人程序,我想以特定格式从列中输出所有值。
@commands.command()
@commands.has_guild_permissions(administrator=True)
async def listchannel(self, ctx):
if ctx.author == bot.user:
return
guild_id = str(ctx.guild.id)
channel = await bot.pg_con.fetch("SELECT channel_id FROM anticrash WHERE guild_id = $1", guild_id)
if not channel:
await ctx.send(f'No channel was not added to this server: {guild_id}')
return
await ctx.send(f"{channel}")
输出是这样的
[<Record channel_id='847854890985980005'>, <Record channel_id='847546806937059341'>]
但我想将输出更改为这种格式
<#847854890985980005>, <#847546806937059341>
【问题讨论】:
标签: python-3.x postgresql discord.py