python - TypeError: 'car' is an invalid keyword argument for print()
问题描述
I don't understand the error. Here is the code,
car = 'mercedes'
print("Is car = 'mercedes'? I predict True.")
print(car = 'mercedes')
print("\nIs car = 'audi'? I predict False.")
print(car = 'audi')
When I try to run this the error is
TypeError: 'car' is an invalid keyword argument for print().
解决方案
if you want to check for equality then use == instead of =
print(car == 'mercedes')
推荐阅读
- sql-server - 乘以 numeric(32,9) 列时的 SQL Server 精度/比例
- java - 在不使用整数的情况下将两个二进制数作为字符串相乘
- java - Windows Servis 应用无法识别 RDP 会话上的智能卡
- python-3.x - 如何使用 Starlette 框架处理 JSON 请求正文
- excel - VBA 中的 SumIf(以变量为条件)
- dart - 如何使用flutter和firestore在google登录期间获取用户displayName的第一个字母?
- python - 在编写 JSON 时防止循环循环的 pythonic 方法是什么?
- c++ - 带线程的 setCursorPosition()
- r - 在反应值消失之前存储它
- c++ - 两个进程之间的共享映射内存在编辑时没有更新