相关文章推荐

检查代码中的错误 class ADB_SHELL: def get_ip(self): # 执行adb shell命令并输出结果 subprocess.check_output( ['adb', 'shell', 'udhcpc'] ) subprocess.check_output( ['adb', 'shell', 'udhcpc -i eth1'] ) self.conf = subprocess.check_output( ['adb', 'shell', 'ifconfig'] ).decode() # conf = str(ip).split(r'\r\r\n') # tmp = conf.replace( "\r\r\n", "\n" ) # print( tmp) self.ip = re.findall( r'addr:(.*?) Bcast', str( self.conf ) ) print(self.ip) for self.i in selfip : speed = subprocess.check_output((['adb', 'shell', f'iperf3 -B {self.i} -c 192.168.102.105'])).decode() print(speed.replace("\r\r\n", "\n")) for i in range(5): write_data = subprocess.check_output(['adb', 'shell', 'time dd if=/dev/zero of=/data/test.data bs=128k count=1024']).decode() print(write_data.replace("\r\r\n", "\n")) read_data = subprocess.check_output(['adb', 'shell', 'time dd if=/data/test.data of=/dev/null bs=128k count=1024']).decode() print(read_data.replace("\r\r\n", "\n")) ls = subprocess.check_output( ['adb', 'shell', 'ls /data'] ).decode() print( ls.replace( '\r', ' ' ) ) dl = subprocess.check_output( ['adb', 'shell', 'rm /data/test.data'] ).decode() l = subprocess.check_output(['adb', 'shell', 'ls /data']).decode() print( l.replace( '\r', ' ' ) ) subprocess.check_output( (['adb', 'shell', f'iperf3 -s']) ) def get_ssh(self): ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy) for i in self.ip: ssh.connect(hostname='192.168.102.105',port=22,username='root',password='xiayi123456',timeout=30) stdin,stdout,stderr = ssh.exec_command(f'iperf3 -c {i}') print(stdout.read()) # ssh.close() if __name__ == '__main__': # get_ip() # get_ssh() A = ADB_SHELL t1 = threading.Thread(target=A.get_ssh) t2 = threading.Thread(target=A.get_ip) t1.start() t2.start() t1.join() t2.join()

35浏览 · 2024-04-29 19:19:53
在第12行[代码](https://geek.csdn.net/educolumn/1572ef9b473b4e00f6b2bf6d428b7c27?spm=1055.2569.3001.10083)中,将 `selfip` 改为 `self.ip`。此外,第28行[代码](https://geek.csdn.net/educolumn/1572ef9b473b4e00f6b2bf6d428b7c27?spm=1055.2569.3001.10083)中的 `ssh.set_missing_host_key_policy` 应该是 `ssh.set_missing_host_key_policy()`。最后,第39行[代码](https://geek.csdn.net/educolumn/1572ef9b473b4e00f6b2bf6d428b7c27?spm=1055.2569.3001.10083)中的 `A = ADB_[shell](https://geek.csdn.net/educolumn/63319ef3ba749171baca9071e5d1024f?spm=1055.2569.3001.10083)` 应该是 `A = ADB_[shell](https://geek.csdn.net/educolumn/63319ef3ba749171baca9071e5d1024f?spm=1055.2569.3001.10083)()`,因为 ADB_SHELL 是一个类,需要实例化才能调用其方法。
相关问题
动性。 人工智能技术已经成为游戏领域的重要组成部分,为游戏的设计和开发提供了更多的可能性。未来,随着人工智能技术的不这段代码有两个小问题: 1. 在`adb_command`变量中,您不需要在adb命令前再加上`adb`。因为您已经在`adb_path`变量中指定了adb的路径,因此只断发展,游戏的智能化和丰富化将会更加突出,为玩家带来更加优秀的游戏体验。 参考文献: [1] 张志华. 人工智能在游戏领域的应用[J]. 现代电子技术, 2017(7): 91-92. [2] 徐乐平需要在`adb_command`变量中写adb shell命令即可。 2. 在Windows系统中,可执行文件通常需要加上`.exe`后缀。因此,您需要将`adb_path`变量中的文件名从`adb`改为`adb.exe`。 请将代码修改为以下形式: ```python import subprocess # 设置adb路径 adb_path. 人工智能技术在游戏开发中的应用[J]. 电脑知识与技术, = r'D:\tools\ADB\platform-tools\adb.exe ```
 
推荐文章