+ 2
Extract data from result
b'SerialNumber \r\r\nINA308X8BS \r\r\n\r\r\n' This is my result from my python code and need to extract INA308X8BS from above line, result may varies from INA308X8BS to other value. Please someone help
6 Respuestas
+ 6
Why is your "string" signed as a byte sequence? Is there any need for that?
Here is a code that should do the job:
inp = 'SerialNumber \r\r\nINA308X8BS \r\r\n\r\r\n'
res = [i for i in inp if i.isalnum()]
print(''.join(res).replace('SerialNumber',''))
+ 1
I dunno what it is but it resulted in 101
a=b'SerialNumber \r\r\nINA308X8BS \r\r\n\r\r\n'
for i,j in enumerate(a.split()):
if j==b'INA308X8BS':
print(a[i])
that 101 is index number for b'INA308X8BX' ,I thought it should be 1
+ 1
Lol I really forgot it could be extracted that easily I went the other way ,
+ 1
Thank you all