英文:
python - discord.py how can I check if double quotes are in intput
问题
Here's the translated code:
@commands.command()
async def test(self, ctx, text):
if """" in text:
await ctx.send("bad")
if text == "ok":
await ctx.send("ok")
else:
await ctx.send("no")
Please note that I've replaced the HTML entity "
with double quotes "
in the translated code.
英文:
@commands.command()
async def test(self, ctx, text):
if "\"" in text:
await ctx.send("bad")
if text == "ok":
await ctx.send("ok")
else:
await ctx.send("no")
When member send !submit askdsk
says no
but if a double quote "
is in input there is no output i tried to do if "\"" in text:
but it didn't work. Any ideas?
答案1
得分: 1
只需像这样检查:
if ''"'' in text:
引用在' '
中的"
。
英文:
just make the check like this
if '"' in text:
quote the " in ' '
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论