想要从xbmc设置导入字符串并将其放入time.sleep函数中。 代码:
debouncing_video = settings.getSetting( "Debounce_video")
debouncing_audio = settings.getSetting( "Debounce_audio")
time.sleep(denouncing_video)
如果我用3替换(debouncing_video),它会等待树秒。如果我打印字符串(denouncing_video)它说3但如果我把time.sleep(debouncing_video)它不工作 谢谢
答案 0 :(得分:0)
返回的值是一个字符串。将其转换为int:
debouncing_video = int(settings.getSetting( "Debounce_video"))
请参阅API:
getSetting(id) -- Returns the value of a setting as a unicode string.
您会在xbmc.log
中看到TypeError: a float is required
的错误。