Printing variables in Python 3.4

The syntax has changed in that print is now a function. This means that the % formatting needs to be done inside the parenthesis:1 However, since you are using Python 3.x., you should actually be using the newer str.format method: Though % formatting is not officially deprecated (yet), it is discouraged in favor of str.format and will most likely be removed from the language in a coming … Read more

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