我在基于Java代码的python中工作。你知道吗
我在Java有这样一个例子:
public static byte[] datosOEM = new byte[900000];
public static byte x1=0,x2=0,x3=0,x4=0,x5=0,x6=0;
我用Python编写了以下文档:
datosOEM=bytes([0x90, 0x00, 0x00])
x1=bytes([0x00])
x2=bytes([0x00])
x3=bytes([0x00])
x4=bytes([0x00])
x5=bytes([0x00])
x6=bytes([0x00])
当我运行程序时,它会显示:
Traceback (most recent call last):
File "test.py", line 63, in <module>
x1=datosOEM[k];
IndexError:string index out of range
如何解决这个问题?任何帮助都会受到欢迎。你知道吗
我的部分代码是:
...
response=port.read(8)
print(response)
k=0
C=0
conexion=True
if(conexion):
while(response>200):
while(C==0):
x1=datosOEM[k];
if(x1=1):
x2=datosOEM[k+1];
...
还有,我该怎么做才能不重蹈覆辙呢?你知道吗
事先谢谢你的帮助
这篇文章是由JasonMArcher编辑的,非常感谢。你知道吗
我不知道你想达到什么目的。也许是这样的?你知道吗
也许你想要这个:
相关问题 更多 >
编程相关推荐