Skip to content
Advertisement

Tag: python-3.x

_tkinter TclError: can’t find package Tix

A friend sent me some Tkinter/Tix code, but it was for Python 2: I have Python 3, I have no Tix installed, and program crashes. After some searching I’ve changed the code to: Thats what I found on the internet. I have no idea if this is a right approach. But code still does no run it crashes on I

Remove comma and change string to float

I want to find “money” in a file and change the string to float , for example, I use regular expression to find “$33,326” and would like to change to [33326.0, “$”] (i.e., remove comma, $ sign and change to float). I wrote the following function but it gives me an error Can you help me debug my code? Answer

Install opencv for Python 3.3

Is OpenCV still not available for Python 3.3 and do I really have to downgrade to Python 2.7 to use it? I didn’t find much about it on the internet, only some posts from 2012 that OpenCV wasn’t yet ported to be used in Python 3.x. But now it’s 2014 and after trying to install the latest OpenCV 2.4.x and

Using len for text but discarding spaces in the count

So, I am trying to create a program which counts the number of characters in a string which the user inputs, but I want to discard any spaces that the user enters. Using this, I can get the number of the characters in each word, without spaces, but I don’t know how to add each number together and print the

Mergesort with Python

I couldn’t find any working Python 3.3 mergesort algorithm codes, so I made one myself. Is there any way to speed it up? It sorts 20,000 numbers in about 0.3-0.5 seconds Answer You can initialise the whole result list in the top level call to mergesort: Then for the recursive calls you can use a helper function to which you

Advertisement