+ 2
python function and .format command
hi please help me understand this code 1.what ".format" do in this in this code ??!! 2.and please tell me what happened in return " resp[1] == 's' "??? def buzz(self, addr, length): resp = self.send_this('+B{}{:0>2x}-'.format(addr, length)) return resp[1] == 's'
2 Antworten
+ 2
1. .format put variables address and length into a string in formated way. for details see
https://pyformat.info
2. it is output of the function. it returns True or False depending on the second character of the string in variable resp
0
ok