【发布时间】:2020-01-24 10:09:10
【问题描述】:
试图为我的网站制作网站货币计算器,问题是它有浮动值,它说 TypeError: float() argument must be a string or a number, not 'Context'
将上下文设为浮动
@x.command()
async def cal(ctx):
veela = requests.get('https://veela.csne.host')
soup = BeautifulSoup(veela.content, 'html.parser')
ar = ""
for text in soup.findAll("h2",attrs={'class':'display-3 font-weight-bold text-uppercase mb-0 animated fadeIn delay-1s'}):
ar += f'{text.text}'
xe = float(ar)+float((ctx))
print(xe)
await ctx.send(float(xe))
我希望它的输出能够工作,因为我在 CMD 上尝试过它并且它工作,但它不适用于不和谐。
【问题讨论】:
标签: python-3.x beautifulsoup floating-point calculator discord.py-rewrite