Hey guys,
I've never been a huge Python fan. I learned it for a course where the teacher was really into it, but his enthusiasm never quite made it to the rest of our class it seems: as soon as we had the chance, we all jumped off to C#/Java.
Anyways. This wasn't a concluding experience, and what annoyed me the most in the language was...
I made a GUI with Tkinter, now how do I make it so when a key command will execute a command even if the Tkinter window is not in focus? Basically I want it so everything is bound to that key command.
Example:
Say I was browsing the internet and the focus was on my browser, I then type Ctrl + U. An event would then run on my program....
Aight, basically, I have a database that looks like this:
id | parentid | type | name
---------------------------------------------
1 | 0 | heading | this is my heading
---------------------------------------------
2 | 1 | child | this is one of many child elements
I'm using Mako to go through that list of data an...
Anyone know how'd I'd go about editing ini file values preferably using ConfigParser? (Or even a place to start from would be great!) I've got lots of comments throughout my config file so I'd like to keep them by just editing the values, not taking the values and playing around with multiple files.
Structure of my config file:
[name1]...
Well, altough the S of the SNMP stands for Simple, yet, so far I haven't experienced it that way. And now that I am about to deploy my software on around around 180 remote Linux servers and wants to monitor the servers and configure my daemons all from a centralized point.
I simply want you to recommend me the library which you'll confi...
I have a fairly large python program that is causing a lot of disk I/O (on top, %wa can get as high as 80, and iotop says that my process is the culprit).
There are several things that may cause this - I'm writing to more than one log file, and I'm saving cached results to disk in several places, so it's not immediately obvious where I ...
I'm reading from certain offsets in several hundred and possibly thousands files. Because I need only certain data from certain offsets at that particular time, I must either keep the file handle open for later use OR I can write the parts I need into seperate files.
I figured keeping all these file handles open rather than doing a sign...
I'm interested in experimenting with embedding Python in my application, to let the user run Python scripts within the application environment, accessing internal (C++-implemented) objects, etc. I'm quite new to this so don't know exactly what I'm doing.
I have read Embedding Python in Another Application, though this seems to talk onl...
try:
case_no = re.search("Case Number:</span></td><td><span class=\"Value\">([^<]*?)<",br.response().read()).group(1)
except:
try:
try:
case_no = re.search("Citation Number:</span></td><td><span class=\"Value\">([^<]*?)<",br.response().read()).group(1)
except:
case_no = r...
Other than cx_Freeze, are there any other current maintained tool suites to generate stand alone executables for Python 3k?
Are there any other techniques for minimizing preinstallation requirements under Windows?
...
Consider the following session. How are the differences explained? I thought that a += b is a syntactical sugar of (and thus equivalent to) a = a + b. Obviously I'm wrong.
>>> import numpy as np
>>> a = np.arange(24.).reshape(4,6)
>>> print a
[[ 0. 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10. 11.]
[ 12. 13. 14. 15. 16. ...
Hi,
I'm using Pexpect to scp and get some files from a remote Linux machine. The script is run from a Linux machine and I'm unable to come to conclusion about the correct regex expression for the prompt which includes an IP.The SCP transfer works fine if IP is hardcoded. It generally looks like:
[email protected]'s password:
For t...
File dir = new File(".");
FileFilter fileFilter = new WildcardFileFilter("sample*.java");
File[] files = dir.listFiles(fileFilter);
for (int i = 0; i < files.length; i++) {
System.out.println(files[i]);
}
for example:
If I have the files shown below in a directory:
FILE NAME DATE CREATED/MODIFIED
proper...
I have a file of the following format
Summary:meeting Description:None DateStart:20100629T110000 DateEnd:20100629T120000 Time:20100805T084547Z
Summary:meeting Description:None DateStart:20100630T090000 DateEnd:20100630T100000 Time:20100805T084547Z
I need to create a function that would retrieve "Summary" at a given "date" and "time"....
Hi all,
I'd like to sanely quiet a few pylint errors when using Django. The two that are causing the greatest irritation are when deriving from django.db.models.Model and accessing objects, and django.test.TestCase. In the first, pylint complains about any code that uses the attribute 'objects', saying it isn't a member. In the second...
I would like to code in c ,but use the value in python by compile the c source file to .so file.
...
I have a complex data structure (user-defined type) on which a large number of independent calculations are performed. The data structure is basically immutable. I say basically, because though the interface looks immutable, internally some lazy-evaluation is going on. Some of the lazily calculated attributes are stored in dictionaries (...
Hi, I am using Flask micro-framework 0.6 and Python 2.6
I need to get the mimetype from an uploaded file so I can store it.
Here is the relevent Python/Flask code:
@app.route('/upload_file', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
file = request.files['file']
mimetype = #FIXME
...
As an exercise, I've been trying out various ways of generating all permutations of a list in Python -- recursive, non-recursive... -- and comparing the performance with itertools.permutations(). But I'm having trouble with the generator version of the recursive method, which doesn't finish cleanly with a StopIteration exception, but ins...
Dear All,
I want to keep the width of the bars the same no matter the number of bars compared is high or low.
I am using Matplotlib stacked bar chart.
the width of the bars is relative to the number of the bars.
Here is my sample code.
How can I make the width the same no matter the number of bars I compare from 1 to 10
import numpy ...