8
Python: ตรวจสอบว่า 'พจนานุกรม' ว่างเปล่าดูเหมือนจะไม่ทำงาน
ฉันพยายามตรวจสอบว่าพจนานุกรมว่างเปล่าหรือไม่ แต่มันทำงานไม่ถูกต้อง มันจะข้ามมันและแสดงออนไลน์โดยไม่มีอะไรยกเว้นการแสดงข้อความ ความคิดใดทำไม def isEmpty(self, dictionary): for element in dictionary: if element: return True return False def onMessage(self, socket, message): if self.isEmpty(self.users) == False: socket.send("Nobody is online, please use REGISTER command" \ " in order to register into the server") else: socket.send("ONLINE " + ' ' .join(self.users.keys()))
396
python
dictionary