0

想要从 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) 它不起作用谢谢

4

1 回答 1

0

返回的值是一个字符串。将其转换为 int:

debouncing_video  =  int(settings.getSetting( "Debounce_video"))

请参阅API

getSetting(id) -- Returns the value of a setting as a unicode string.

你会在xbmc.logthat中看到一个错误TypeError: a float is required

于 2013-02-23T15:55:35.720 回答