'builtin_function_or_method' object has no attribute 'js'
时间: 2023-09-02 17:10:36 浏览: 47
这个错误是由于在代码中使用了一个名为'shuffle'的函数,但是该函数被错误地当作了一个内置函数或方法。根据引用\[1\]中的错误信息,可以看出问题出现在data_iter函数的实现中。在该函数中,尝试使用shuffle函数对indices进行随机打乱,但是由于shuffle被错误地当作了一个内置函数或方法,所以导致了该错误。
为了解决这个问题,可以参考引用\[2\]中的改正后的代码。在改正后的代码中,可以看到使用了random模块的shuffle函数对indices进行了随机打乱。所以,你需要确保在代码中正确地导入了random模块,并使用random.shuffle函数对indices进行随机打乱。
另外,引用\[3\]中提供了两种获取当前时间的方法,但是与你的问题无关。所以,你可以忽略引用\[3\]中的内容。
综上所述,你需要检查代码中是否正确导入了random模块,并使用random.shuffle函数对indices进行随机打乱,以解决这个错误。
#### 引用[.reference_title]
- *1* *2* [AttributeError: ‘builtin_function_or_method‘ object has no attribute ‘shuffle](https://blog.csdn.net/wzk4869/article/details/127933044)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [成功解决 AttributeError: ‘builtin_function_or_method‘ object has no attribute ‘strftime](https://blog.csdn.net/JingpengSun/article/details/131130824)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]