Advertisement
cardel

Ejemplo Python

Jun 29th, 2023
955
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1.  
  2. #Escribir archivo
  3. f=open("salida.bin","wb")
  4. data=[1,1,1,0,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,00,0,0,1,0,1,0,1,1,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1]
  5. print(data)
  6. arr=bytearray(data)
  7. f.write(arr)
  8. f.close()
  9.  
  10. #Leer archivo
  11. fin = open("salida.bin","rb")
  12. dataIn = fin.read()
  13. dataDec = [data[x] for x in range(0,len(dataIn))]
  14. print(dataDec)
  15. fin.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement