对掩码 link 使用变量; discord.py 嵌入通过 webhook 发布; python
Using a variable for a masked link; discord.py embed posted through webhook; python
对于将 post 链接的不和谐机器人,它输出的 URL 被屏蔽
variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value=str("![test]!({variable})"))
不知道这是怎么回事
embed.add_field(name=str(field[0]), value=str("![test]!( https://www.google.com)"))
variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value="![test]!({})".format(variable))
format
将 {}
替换为给定的字符串。
我想你是想使用 f-strings
variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value=str(f"![test]!({variable})"))
这是一个 f-string 与格式化
的示例
a=1
print('{a}') #prints {a}
print('{}'.format(a)) #prints 1
print(f'{a}') #also prints 1
对于将 post 链接的不和谐机器人,它输出的 URL 被屏蔽
variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value=str("![test]!({variable})"))
不知道这是怎么回事
embed.add_field(name=str(field[0]), value=str("![test]!( https://www.google.com)"))
variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value="![test]!({})".format(variable))
format
将 {}
替换为给定的字符串。
我想你是想使用 f-strings
variable = url + "/collection/" + str(field[1]) + "test"
embed.add_field(name=str(field[0]), value=str(f"![test]!({variable})"))
这是一个 f-string 与格式化
的示例a=1
print('{a}') #prints {a}
print('{}'.format(a)) #prints 1
print(f'{a}') #also prints 1