python - 使用 int() 错误
问题描述
谁能看到这段代码有什么问题:
offset = int((round((width - resize_width) / 2)), int(round((height - resize_height) / 2)))
这是我的错误信息:
TypeError: int() can't convert non-string with explicit base
谢谢,路易斯
解决方案
看看你的括号位置:
offset = int(
( round((width - resize_width) / 2) ),
int( round((height - resize_height) / 2) )
)
您的外部调用int
有两个参数。您已将第二个int(round(...
值作为基本参数传递。也许你想要点坐标?
offset = (int(round((width - resize_width ) / 2)),
int(round((height - resize_height) / 2))
)
推荐阅读
- tensorflow - TensorFlow:查询会话配置
- git - 如何控制 git diff 标头中的哈希长度
- javascript - d3 强制布局:d3 是否需要节点中的某些顺序才能正常工作?
- ios - 有没有办法抵消 tableview 动画,使它们不会一次全部显示?
- amazon-web-services - 如何允许 EB 访问 S3
- swift - 按钮标题未显示来自 Firebase 的数据
- sql-server - 使用 MSSQL 将文件组添加到 flyway_schema_history 表
- c# - 如何使用 Mono 在 Raspberry Pi 上构建 .NET 代码?
- objective-c - NSMachBootstrapServer 已弃用,如何使用 NSXPCConnection 注册 Mach 服务?
- javascript - 如何让 Selenium 更新 Facebook 个人资料图片