として解釈することができない私は、コードのこの部分を持っている:Pythonの例外TypeError:「strの」オブジェクトが整数
if current_ins[0] == "REPEAT":
for i in range(current_ins[1]):
if last_ins != "":
instructions.append(last_ins)
if delay != -1:
instructions.append(["DELAY", delay])
else:
print ("ERROR: REPEAT can't be the first instruction")
sys.exit(-1)
と、残念ながら私はこのエラーを取得する:
Duck Encoder 0.1.1 by Roger Serentill & GoldraK
Traceback (most recent call last):
File "D:\devloc\Encoders-decoders\USB-Rubber-Ducky-master\Encoder\Encoder.py", line 379, in <module>
p.compile(sys.argv)
File "D:\devloc\Encoders-decoders\USB-Rubber-Ducky-master\Encoder\Encoder.py", line 56, in compile
instructions = self.__read_file()
File "D:\devloc\Encoders-decoders\USB-Rubber-Ducky-master\Encoder\Encoder.py", line 263, in __read_file
for i in range(current_ins[1]):
TypeError: 'str' object cannot be interpreted as an integer
私は何ができますか?
私はPython3を使用しています。
'current_insは、[1]'は何が含まれていない - :あなたが興味を持っている場合
は、見てみましょうか?可能であれば、数値を含む文字列になる可能性があり、変換する必要があります: 'range(int(current_ins [1]))' – Elisha
ありがとう! range(int(current_ins [1]))は完全に機能します! – devlime26