I have a measurement device which is being read by Python into an integer array. How do I append the array with an extra 10 integer "locations"? I have tried ".extend", ".append", "+", and have not been able to make any of them work.
Summary Code:
DataByte = []
DataByte = Read_Instrument() # This fills DataByte
When I use:
DataByte.append(1)
I get 'Array[int]' object has no attribute 'append'
If I try:
DataByte.extend([1])
I get 'Array[int]' object has no attribute 'extend'
If I try:
DataByte = DataByte + (1)
I get error message saying I can't combine integer with string
If you want to append 10 elements to your list :
>>> [1,2,3]+[None]*10
[1, 2, 3, None, None, None, None, None, None, None, None, None, None]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.