Guest User

Untitled

a guest
Jan 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import os
  2. fp=open("try.ts","rb")
  3. for i in range(100):
  4. buf=fp.read(188)
  5. if buf[0]=="x47"
  6. print "OK"
  7. fp.close()
  8.  
  9. if buf[0]=="x47"
  10. ^
  11. SyntaxError: invalid syntax
  12.  
  13. if buf[0]=="x47":
  14. IndexError: string index out of range
  15.  
  16. if buf[0]=="x47":
  17. IndexError: string index out of range
  18.  
  19. with open('wxasrs.mp3','rb') as f:
  20. print(isinstance(f.read(), str))
  21. print(isinstance(f.read(), bytes))
  22.  
  23. False
  24. True
Add Comment
Please, Sign In to add comment