String prefix question

Gerard Flanagan grflanagan at
Mon Nov 9 17:53:43 CET 2009

Alan Harris-Reid wrote:
> In the 3.1 documentation (section 20.4.6), there is a simple 
> “Hello World” WSGI application which includes the following method...
> def hello_world_app(environ, start_response):
> status = b'200 OK' # HTTP Status
> headers = [(b'Content-type', b'text/plain; charset=utf-8')] # HTTP Headers
> start_response(status, headers)
> # The returned object is going to be printed
> return [b"Hello World"]
> Question - Can anyone tell me why the 'b' prefix is present before each 
> string? The method seems to work equally well with and without the 
> prefix. From what I can gather from the documentation the b prefix 
> represents a bytes literal, but can anyone explain (in simple english) 
> what this means?
> Many thanks,
> Alan

Another link:

More information about the Python-list mailing list