How to XOR two strings in Python

Hi, The following function is returning the result of hex() which returns a string. You should use the ^ operator on integers. I’m not sure though that’s the result you’re looking for. If you want to XOR two strings, it means you want to XOR each character of one string with the character of the other string. You should then … Read more

matplotlib does not show my drawings although I call pyplot.show()

If I set my backend to template in ~/.matplotlib/matplotlibrc, then I can reproduce your symptoms: ~/.matplotlib/matplotlibrc: Note that the file matplotlibrc may not be in directory ~/.matplotlib/. In this case, the following code shows where it is: If you edit ~/.matplotlib/matplotlibrc and change the backend to something like GtkAgg, you should see a plot. You … Read more

Python socket.error: [Errno 111] Connection refused

The problem obviously was (as you figured it out) that port 36250 wasn’t open on the server side at the time you tried to connect (hence connection refused). I can see the server was supposed to open this socket after receiving SEND command on another connection, but it apparently was “not opening [it] up in … Read more

python pip on Windows – command ‘cl.exe’ failed

You are installing a package with parts written in C/C++, so you need to have cl.exe (the Microsoft C Compiler) installed on your computer and in your PATH. PATH is an environment variable that tells Windows where to find executable files. First, ensure the C++ build tools for Visual Studio are installed. If you already … Read more