小编Vis*_*hnu的帖子

处理来自 IOS 设备的请求时发生异常

我正在尝试在 iOS 设备上播放视频。当我尝试播放时,出现以下错误:

[27/Apr/2015 06:59:30] "GET /media/2015/04/VID_20150327_112644.mp4 HTTP/1.1" 200 18

 Exception happened during processing of request from ('192.168.1.230', 51412)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/likewise-open/ZEALOUSYS/manesh/virtualenv/tracks/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno …
Run Code Online (Sandbox Code Playgroud)

python sockets django ios django-rest-framework

5
推荐指数
1
解决办法
4304
查看次数

从十六进制值转换为二进制值

正在将一个值从十六进制转换为二进制值。我使用了 python 的 bin() ,如下所示:

value = 05808080
print bin(int(value, 16))

output i got is 0b101100000001000000010000000(output should be 32 bit)
output should be 0000 0101 1000 0000 1000 0000 1000 0000(correct output)
Run Code Online (Sandbox Code Playgroud)

输出中的这个“b”是什么以及如何用正确的二进制值替换它。我认为这里的两个值几乎相同,除了输出中“b”的问题。我将如何解决这个问题?

binary hex type-conversion python-2.7

3
推荐指数
1
解决办法
2万
查看次数