String modifying error, trying to delete data in string
Mark Lawrence
breamoreboy at yahoo.co.uk
Mon Mar 24 12:31:51 EDT 2014
On 24/03/2014 16:20, mikie wrote:
> Here is some code:
> import socket,sys
>
> s=socket.socket()
> port=int(sys.argv[1])
> s.bind(("127.0.0.1",port))
> s.listen(2)
> cls,addr=s.accept()
>
> data=cls.recv(1024)
> f=data.pop("Proxy-Connection")
> cls.close()
>
> Im trying to delete some headers in the request but get an error saying:
> 'str' object has no attribute 'pop'
>
> How can I modify data received from the client?
>
Strings are immutable so you'll need string methods to manipulate your
data see
http://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
More information about the Python-list
mailing list