text stringlengths 226 34.5k |
|---|
How do I import a COM object namespace/enumeration in Python?
Question: I'm relatively new to programming/python, so I'd appreciate any help I can
get. I want to save an excel file as a specific format using Excel through
COM. Here is the code:
import win32com.client as win32
def excel():
... |
Convert & to & in Python
Question: I'm working on a simple crawler in Python. The aim is to create a sitemap.xml.
(you can find the very alpha version here:
<http://code.google.com/p/sitemappy/>) I noticed that if I generate the xml
with URLs containing non HTML entities (such as &), the xml doesn't validate
and it... |
Python Array is read-only, can't append values
Question: I am new to Python. The following code is causing an error when it attempts to
append values to an array. What am I doing wrong?
import re
from array import array
freq_pattern = re.compile("Frequency of Incident[\(\)A-Za-z\s]*\.*\s*([\... |
Run command pipes with subprocess.Popen
Question: How can I run the following command using
[`subprocess.Popen`](http://docs.python.org/library/subprocess.html#subprocess.Popen)?
mysqldump database_name table_name | bzip2 > filename
I know [`os.system()`](http://docs.python.org/library/os.html#os.s... |
Google Search from a Python App
Question: I'm trying to run a google search query from a python app. Is there any python
interface out there that would let me do this? If there isn't does anyone know
which Google API will enable me to do this. Thanks.
Answer: There's a simple example
[here](http://www.ajaxlines.com/a... |
How do I fetch an XML document and parse it with Python twisted?
Question: I want a fast way to grab a URL and parse it while streaming. Ideally this
should be super fast. My language of choice is Python. I have an intuition
that twisted can do this but I'm at a loss to find an example.
Answer: If you need to handle ... |
Nose test script with command line arguments
Question: I would like to be able to run a nose test script which accepts command line
arguments. For example, something along the lines:
test.py
import nose, sys
def test():
# do something with the command line arguments
print sys.ar... |
BeautifulSoup with Jython
Question: I just tried to run BeautifulSoup (3.1.0.1) with Jython (2.5.1) and I was
amazed to see how much slower it was than CPython. Parsing a page
(<http://www.fixprotocol.org/specifications/fields/5000-5999>) with CPython
took just under a second (0.844 second to be exact). With Jython it ... |
Python on windows7 intel 64bit
Question: I've been messing around with Python over the weekend and find myself pretty
much back at where I started.
I've specifically been having issues with easy_install and nltk giving me
errors about not finding packages, etc.
I've tried both Python 2.6 and Python 3.1.
I think part... |
Python urllib2: Reading content body even during HTTPError exception?
Question: I'm using urllib2 to fetch a a page via HTTP. Sometimes the resource throws a
HTTP error 400 (Bad Request) when my request contains an error. However, that
response also contains an XML element that gives a detailed error message. It
would ... |
Python string interning and substrings
Question: Does python create a completely new string (copying the contents) when you do
a substring operation like:
new_string = my_old_string[foo:bar]
Or does it use interning to point to the old data ?
As a clarification, I'm curious if the underlying chara... |
Reading from files in python
Question: I need to find out the maximum and minimum value in a line by reading a file
and should be dividing the maximum value by the minimum value. Am interested
to do this in python.
the contents of the file (file.txt) looks like this..
A28102_at,151,263,88,484,118,270,45... |
Delineating a Read File
Question: Not really too sure how to word this question, therefore if you don't
particularly understand it then I can try again.
I have a file called _example.txt_ and I'd like to import this into my Python
program. Here I will do some calculations with what it contains and other
things that ar... |
Saving work after a SIGINT
Question: I have a program which takes a long time to complete. I would like it to be
able to catch `SIGINT` (ctrl-c) and call the `self.save_work()` method.
As it stands, my `signal_hander()` does not work since `self` is not defined
by the time the program reaches `signal_handler()`.
How ... |
Django Tests fail with InternalError: no such savepoint. DB: Postgres, passes on mysql
Question: Interestingly it also works on the shell.
[MY code which calls Model.objects.get_or_create(...)]
File "/usr/lib/python2.5/site-packages/django/db/models/manager.py", line 123, in get_or_create
... |
Python ClientForm Error
Question:
import ClientForm
from urllib2 import urlopen
page = urlopen('http://garciainteractive.com/blog/topic_view/topics/content/')
form = ClientForm.ParseResponse(page, backwards_compat=False)
print form[0]
The problem is that ClientForm parses the first html ... |
BioPython: extracting sequence IDs from a Blast output file
Question: I have a BLAST output file in XML format. It is 22 query sequences with 50
hits reported from each sequence. And I want to extract all the 50x22 hits.
This is the code I currently have, but it only extracts the 50 hits from the
first query.
... |
Why we should perfer to store the serialized data not the raw code to DB?
Question: If we have some code(a data structure) which should be stored in DB, someone
always suggests us to store the serialized data not the raw code string.
So I'm not so sure why we should prefer the serialized data.
Give a simple instance(... |
Problem with python soap library suds. Wsdl was not understood
Question: The code below throw a SAXParseException: "mismatched tag":
from suds.client import Client <br>
url = 'http://www.didww.com/api/?wsdl'
client = Client(url, cache=None)
print client
Is it problem with suds, or... |
sorl.thumbnail : 'thumbnail' is not a valid tag library?
Question: I am trying to install sorl.thumbnail but am getting the following error
message:
'thumbnail' is not a valid tag library: Could not load template library from
django.templatetags.thumbnail, No module named PIL
This error popped up in this question as ... |
Getting the Current Table in Numbers (Python/Appscript)
Question: How do I access the current table in Numbers using `py-appscript`?
* * *
For posterity, the program I created using this information clears all the
cells of the current table and returns the selection to cell `A1`. I turned it
into a Service using a py... |
Weekly-based populating a database with the django admin
Question: I'm building an small django app in order to manage a store employees roster.
The employees are freelancers-like, they have weekly almost-fixed schedules,
and may ask for extra ones at any weekday/time.
I'm new to both python and django, and I'm using ... |
How to implement a pythonic equivalent of tail -F?
Question: What is the pythonic way of watching the tail end of a growing file for the
occurrence of certain keywords?
In shell I might say:
tail -f "$file" | grep "$string" | while read hit; do
#stuff
done
Answer: Well, the simplest w... |
Call Python function from MATLAB
Question: I need to call a Python function from MATLAB. how can I do this?
Answer: I had a similar requirement on my system and this was my solution:
In MATLAB there is a function called perl.m, which allows you to call perl
scripts from MATLAB. Depending on which version you are usi... |
send string to serial
Question: Buongiorno, I'm trying to send a simple string to a serial port to command an
instrument for noise measures.
The strings are very easy:
"M 1" = instrument on
"M 2" = instrument off
"M 3" = begin the measure
"M 4" = stop the measure
I've found this program:
imp... |
Euclidian Distance Python Implementation
Question: I am playing with the following code from programming collective intelligence,
this is a function from the book that calculated eclidian distance between two
movie critics.
This function sums the difference of the rankings in the dictionary, but
euclidean distance in ... |
[Resolved]Python socket not receiving anything
Question: I'm trying to receive a variable length stream from a camera with python, but
get weird behaviour. This is Python 2.6.4 (r264:75706) on linux(Ubuntu 9.10)
The message is supposed to come with a static header followed by the size, and
rest of the stream. here is ... |
Another neural network knight's tour conundrum
Question: I've done my best to make a simple java implementation of the neural network
knight's tour finder but I'm completely stumped as to why it fails to work..
there are 6 classes, 3 for the GUI which im pretty sure works fine, and 3 to
deal with the actual logic etc.... |
Will python.subprocess(cppBinaryExe) compromise cppBinaryExe's performance?
Question: i am quite new to python.subprocess()
if i folk a new process from python, will the execution speed of this new
process be compromised?
imagine that i have the
#python
import subprocess
subprocess.call( MyBin... |
How to get SIP to find .sip files for and installed library
Question: I'm trying to create python bindings for [source-highlight-
qt](http://srchiliteqt.sourceforge.net/) using sip.
I'm working on ubuntu - I've installed python-qt4-dev, which has installed the
pyqt sip files to /usr/share/sip/PyQt4/
In my sip file, I... |
Principal component analysis in Python
Question: I'd like to use principal component analysis (PCA) for dimensionality
reduction. Does numpy or scipy already have it, or do I have to roll my own
using
[`numpy.linalg.eigh`](http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.eigh.html)?
I don't just want t... |
Quitting matplotlib.pyplot animation gracefully
Question: I have a script that plots data of some photometry apertures, and I want to
plot them in an xy plot. I am using matplotlib.pyplot with python 2.5.
The input data is stored in around 500 files and read. I am aware that this is
not the most efficient way of input... |
Calling Method from Different Python File
Question: As I'm currently learning Django / Python, I've not really been using the
concept of Classes, yet. As far as I'm aware the method isn't static.. it's
just a standard definition.
So let's say I have this Package called `Example1` with a `views.py` that
contains this m... |
A dictionary with values that are dictionaries: trying to sum across those keys in python
Question: Data structure is a dictionary, each value is another dictionary, like:
>>> from lib import schedule
>>> schedule = schedule.Schedule()
>>> game = schedule.games[0]
>>> game.home
<lib.sched... |
Python: Issue reading data lines multiple times from a file
Question: I am trying to make a Python2.6 script on a Win32 that will read all the text
files stored in a directory and print only the lines containing actual data. A
sample file -
Set : 1
Date: 10212009
12 34 56
25 67 90
End ... |
To understand Python's optparse
Question: Thank you for quack in pointing out the off-by-one!
The following code is my first attempt in writing code with Optparse.
**How can you fix the following bug in getting the help by Optparse?**
#!/usr/bin/env python
import sys
import os
from optparse... |
Python detect USB drive then assign drive letter?
Question: Here is the problem. We have 100s of external 500gb USB drives. Each drive
will travel to a new location through the year. What is the best way to
automatically detect that a USB drive has been plugged into a Windows system,
then assign a Z:\ drive letter? The... |
replacing Matlab with python
Question: i am a engineering student and i have to do a lot of numerical processing,
plots, simulations etc. The tool that i use currently is Matlab. I use it in
my university computers for most of my assignments. However, i want to know
what are the free options available.
i have done som... |
Making ORM with Python's Storm
Question: The question is based on [the
thread](http://stackoverflow.com/questions/1779239/converting-sql-commands-to-
pythons-orm), since I observed that Storm allows me reuse my SQL-schemas.
**How can you solve the following error message in Storm?**
The code is based on Jason's answe... |
Distribute a Python program with a minimal environment
Question: I want to distribute a Python application to windows users who don't have
Python or the correct Python version.
I have tried py2exe conversion but my Python program is really complex and
involve code import on the fly by xmlrpc process so it is not suita... |
How to apply a logical operator to all elements in a python list
Question: I have a list of booleans in python. I want to AND (or OR or NOT) them and get
the result. The following code works but is not very pythonic.
def apply_and(alist):
if len(alist) > 1:
return alist[0] and apply_and(ali... |
Running average in Python
Question: Is there a pythonic way to **build up a list that contains a running average**
of some function?
After reading a fun little piece about [Martians, black boxes, and the Cauchy
distribution](http://www.johndcook.com/Cauchy%5Festimation.html), I thought it
would be fun to calculate a r... |
Python: Analyzing complex statements during execution
Question: I am wondering if there is any way to get some meta information about the
interpretation of a python statement during execution.
Let's assume this is a complex statement of some single statements joined with
**or** (A, B, ... are boolean functions)
... |
Passing SQLite variables in Python
Question: I am writing a app in python and utilzing sqlite. I have a list of strings
which I would like to add too the database, where each element represents some
data which coincides with the column it will be put.
currently I have something like this
cursor.execute(... |
How can I get a list of all classes within current module in Python?
Question: I've seen plenty of examples of people extracting all of the classes from a
module, usually something like:
# foo.py
class Foo:
pass
# test.py
import inspect
import foo
for name, obj in in... |
Overcoming Python's limitations regarding instance methods
Question: It seems that Python has some limitations regarding instance methods.
1. Instance methods can't be copied.
2. Instance methods can't be pickled.
This is problematic for me, because I work on a very object-oriented
[project](http://garlicsim.org)... |
How to identify whether a variable is a class or an object
Question: I am working at a bit lower level writing a small framework for creating test
fixtures for my project in Python. In this I want to find out whether a
particular variable is an instance of a certain class or a class itself and if
it is a class, I want ... |
Scrapy spider index error
Question: This is the code for Spyder1 that I've been trying to write within Scrapy
framework:
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from scr... |
Scrapy spider is not working
Question: Since nothing so far is working I started a new project with
python scrapy-ctl.py startproject Nu
I followed the tutorial exactly, and created the folders, and a new spider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.con... |
What's an easy way to implement a --quiet option in a python script
Question: Am working on a command line python script - throughout the script, I have a
lot of information I am `print`-ing to the terminal window so that I may
follow along with what is happening.
Using `OptionParser` I want to add a `--quiet` option ... |
Python OLE2 date format conversion
Question: I have created a python script which pulls data out of OLE streams in Word
documents, but am having trouble converting the OLE2-formatted timestamp to
something more human-readable :(
The timestamp which is pulled out is 12760233021 but I cannot for the life of
me convert t... |
Redirecting a user in a django template
Question: I have a django website that is spilt depending on what user type you are, I
need to redirect users that are not entitled to see certain aspects of the
site,
in my template, I have
{% if user.get_profile.is_store %}
<!--DO SOME LOGIC-->
{%end... |
Using C++ in xcode for image and video processing
Question: I am studying in the area of image and video processing - specifically in the
field of pattern recognition (objects, people etc.). I wish to use a
programming language to apply the transformation to images and video (more
importantly video). I am thinking of u... |
Solving a cubic equation
Question: As part of a program I'm writing, I need to solve a cubic equation exactly
(rather than using a numerical root finder):
a*x**3 + b*x**2 + c*x + d = 0.
I'm trying to use the equations from
[here](http://en.wikipedia.org/wiki/Cubic_function#Root-finding_formula).
Ho... |
pythonic way to aggregate arrays (numpy or not)
Question: I would like to make a nice function to aggregate data among an array (it's a
numpy record array, but it does not change anything)
you have an array of data that you want to aggregate among one axis: for
example an array of `dtype=[(name, (np.str_,8), (job, (np... |
Ranking Elements of multiple Lists by their count in Python
Question: I want to rank multiple lists according to their elements how often they
appear in each list. Example:
list1 = 1,2,3,4
list2 = 4,5,6,7
list3 = 4,1,8,9
result = 4,1,2,3,4,5,6,7,8 (4 is counted three times, 1 two times and the rest
once)
I've ... |
media.set_xx ValueError
Question: New guy here. I asked a while back about a sprite recolouring program that I
was having difficulty with and got some great responses. Basically, I tried to
write a program that would recolour pixels of all the pictures in a given
folder from one given colour to another.
I believe I ha... |
Python time comparison
Question: How do I compare times in python?
I see that date comparisons can be done and there's also "timedelta", but I'm
struggling to find out how to check if the current time (from datetime.now())
is earlier, the same, or later than a specified time (e.g. 8am) regardless of
the date.
Answer... |
Looking for advice on how to develop applets for Gnome / Ubuntu
Question: I am a linux (mostly ubuntu) user with a reasonable understanding of how the
system works (although I am certainly **not** a linux guru!). In the past I
have developed small cross-platform desktop applications in python/GTK and I
delivered them t... |
pygst - glimagesink callback
Question: I'm trying to use 'glimagesink' element with python. The element (which is
GObject inside) has `client-draw-callback` property which should (in C++ at
least) contain a function (`bool func(uint t, uint w, uint h)`) pointer. I've
tried `element.set_property('client-draw-callback', ... |
python X.509 asymmetric encryption
Question: Hello I'm trying to understand how certificate and asymmetric encryption
works. I'm looking for a python library where i can import public or private
ca signed certificates and automatically encrypt or decrypt message in string
format, i viewed the crypto library embedded in... |
sparse assignment list in python
Question: I need a list with the following behavior
>>> l = SparseList()
>>> l
[]
>>> l[2] = "hello"
>>> l
[ None, None, "hello"]
>>> l[5]
None
>>> l[4] = 22
>>> l
[ None, None, "hello", None, 22]
>>> len(l)
5
>>> for i ... |
psycopg2 vs sys.stdin.read()
Question: Dear all I have small code like below :
#!/usr/bin/python
import psycopg2, sys
try:
conn = psycopg2.connect("dbname='smdr' user='bino'");
except:
print "I am unable to connect to the database"
cur = conn.cursor()
v_num = '1' ... |
Django to use different settings.py file based on subdomains
Question: How can Django use different settings.py file based on subdomains.
Can these utilities ("django-admin", "python manage.py") still be used if
there were different settings connecting to different databases.
Answer: ok you have two dimensions you n... |
Insights on SystemError: com_backpatch: offset too large
Question: In python, `"SystemError: com_backpatch: offset too large"` is thrown when
executing the code generated by the following:
f = open("test.py", "w")
f.write("def fn():\n a =1000\n")
for a in xrange(3000):
if a == 0:
... |
Having trouble installing PIL in Snow Leopard
Question: I followed these instructions:
<http://proteus-tech.com/blog/cwt/install-pil-in-snow-leopard/>
And everything went as described.
However, at the end, I tried running:
python selftest.py
to verify that everything is working properly, but I g... |
Use Python to extract ListView items from another application
Question: I have an application with a ListView ('SysListView32') control, from which I
would like to extract data. The control has 4 columns, only textual data.
I have been playing around the following lines (found online somewhere):
VALUE_L... |
Is it possible to make a custom mouse cursor with Python Tkinter? (Using matplotlib with the TkAgg backend)
Question: It's likely that this is just a general Python Tkinter question, not
necessarily a matplotlib one.
So I'm in the midst of developing a rather large suite of plotting
functionality on top of matplotlib ... |
Request for comments: python class factory for group of constant values
Question: The following python module is meant to be a basis for "constant" handling in
python. The use case is the following:
* one groups some constants (basically "names") that belong together with their values into a dictionary
* with that... |
Find the nth occurrence of substring in a string
Question: This seems like it should be pretty trivial, but I am new at Python and want
to do it the most Pythonic way.
I want to find the n'th occurrence of a substring in a string.
There's got to be something equivalent to what I WANT to do which is
`mystring.find("s... |
Refactor large models.py file in Django app
Question: After reading monokrome's answer to [Where should Django manager code
live?](http://stackoverflow.com/questions/1883322/where-should-django-manager-
code-live), I've decided to split a large `models.py` into smaller, more
manageable files. I'm using the folder struc... |
How can I auto-populate a PDF form in Django/Python?
Question: I have PDF forms that I want to autopopulate with data from my Django web
application and then offer to the user to download. What python library would
let me easily pre-populate PDF forms? These forms are intended to be printed
out.
Answer: Reportlab is ... |
wxPython - picking the right sizer to use in an application
Question: I'm having trouble figuring out how to get the sizers in wxPython to work the
way I want them to (aside: am I the only one who thinks that wxPython is
poorly documented?). I've got 4 buttons and a textctrl that I want arranged
like so:
... |
Python tempfile module and threads aren't playing nice; what am I doing wrong?
Question: I'm having an interesting problem with threads and the tempfile module in
Python. Something doesn't appear to be getting cleaned up until the threads
exit, and I'm running against an open file limit. (This is on OS X 10.5.8,
Python... |
libnet creates UDP packets with invalid checksums
Question: I'm using pylibnet to construct and send UDP packets. The UDP packets I
construct in this way all seem to have invalid checksums. Example:
# python
Python 2.4.3 (#1, Sep 3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux... |
Python: Checking Header Format
Question: I'm new to python and need help with a problem. Basically I need to open a
file and read it which I can do no problem. The problem arises at line 0,
where I need to check the header format.
The header needs to be in the format: `p wncf nvar nclauses hard` where 'nvar'
'nclauses... |
split svnversion output in bash
Question: I have this function, works fine, but I would like to rewrite it in bash. the
problem is, I have too little knowledge of what's available in bash.
#!/usr/bin/python
def parse_svnversion(value):
"""split the output of svnversion into its three com... |
Problems installing MySQL-python-1.2.3c1 on Mac Snow Leopard
Question: Hi All I am having a problem installing the Python MySQL connector (MySQL-
python-1.2.3c1) on my Mac OSX Snow Leopard.
**System State**
I have manually compiled an installed: **mysql-5.1.41**
This seems to work fine, as I can create and query a d... |
Examples of using Doctests in Django in an Agile / BDD way
Question: I'm interested in learning how to Doctests and Unit tests in a more Agile /
BDD way. I've found a few tutorials that seem reasonable, but they are just
thumbnails. What I would really like to see is the source code of some Django
projects that were de... |
From Sax to Dom with DTD (python)
Question: I need a validated DomTree with DTD (to use `getElementById`). Validating and
Parsing works, but the dom does't work properly:
from xml.dom import minidom
from xml.dom.pulldom import SAX2DOM
from lxml import etree
import lxml.sax
from StringIO ... |
Parsing XML to a hash table
Question: I have an XML file in the following format:
<doc>
<id name="X">
<type name="A">
<min val="100" id="80"/>
<max val="200" id="90"/>
</type>
<type name="B">
<min val="100" id="20"/>
<max val="20" id="90"/>
</t... |
Nested SSH session with Paramiko
Question: I'm rewriting a Bash script I wrote into Python. The crux of that script was
ssh -t first.com "ssh second.com very_remote_command"
I'm having a problem with the nested authentication with paramiko. I wasn't
able to find any examples dealing with my precise... |
Marking a frame as sticky with wxPython
Question:
Is there a way to set the "sticky" bit for a frame/window, with wxPython?
(wxPython 2.8.9.1 under Ubuntu Jaunty)
Answer: Here's what I came up with:
import gtk
def set_sticky(frame):
gdkwin = gtk.gdk.window_lookup(frame.GetHandle())... |
split a generator/iterable every n items in python (splitEvery)
Question: I'm trying to write the Haskel function 'splitEvery' in Python. Here is it's
definition:
splitEvery :: Int -> [e] -> [[e]]
@'splitEvery' n@ splits a list into length-n pieces. The last
piece will be shorter if @n@ ... |
Inheritable custom exceptions in python
Question: I want to create some custom exceptions for my class. I am trying to figure
out the best way to make these exception classes inheritable in derived
classes. The tutorial shows how to create the Exception classes. So I did that
like this:
I created a baseclass.py:
... |
Compare two images the python/linux way
Question: Trying to solve a problem of preventing duplicate images to be uploaded.
I have two JPGs. Looking at them I can see that they are in fact identical.
But for some reason they have different file size (one is pulled from a
backup, the other is another upload) and so they... |
packaging cryptography software and distributing
Question: I'm developing a python GUI application and plan on calling external program
packaged with my program to do some encryption. I noticed from sites like
OpenSSL that talk about export laws regarding cryptography software.
If I can't package binary forms of the c... |
Python - specify which function in file to use on command line
Question: Assume you have a programme with multiple functions defined. Each function is
called in a separate for loop. Is it possible to specify which function should
be called via the command line?
Example:
python prog.py -x <<<filname>>>
... |
Xpath builder in Python
Question: I'm building relatively complicated xpath expressions in Python, in order to
pass them to selenium. However, its pretty easy to make a mistake, so I'm
looking for a library that allows me to build the expressions without messing
about with strings. For example, instead of writing
... |
numpy to matlab interface with mlabwrap
Question: I am looking for a simple way to visualize some of my data in numpy, and I
discovered the `mlabwrap` package which looks really promising. I am trying to
create a simple plot with the ability to be updated as the data changes.
Here is the matlab code that I am trying t... |
How to import constants from .h file into python module
Question: What is a recommended way to import a bunch of constants defined in a c-style
(not c++, just plain old c) .h file into python module so that it can be used
in python's part of a project. In the project we use a mix of languages and in
perl I can do this ... |
Python 3: create a list of possible ip addresses from a CIDR notation
Question: I have been handed the task of creating a function in python (3.1) that will
take a CIDR notation and return the list of possible ip addresses. I have
looked around python.org and found this:
<http://docs.python.org/dev/py3k/library/ipaddr.... |
Does Python support MySQL prepared statements?
Question: I worked on a PHP project earlier where prepared statements made the SELECT
queries 20% faster.
I'm wondering if it works on Python? I can't seem to find anything that
specifically says it does or does NOT.
Answer: Most languages provide a way to do generic pa... |
What's the point of a main function and/or __name__ == "__main__" check in Python?
Question: > **Possible Duplicate:**
> [What does <if __name__=="__main__":>
> do?](http://stackoverflow.com/questions/419163/what-does-if-namemain-do)
I occasionally notice something like the following in Python scripts:
... |
get many pages with pycurl?
Question: I want to get many pages from a website, like
curl "http://farmsubsidy.org/DE/browse?page=[0000-3603]" -o "de.#1"
but get the pages' data in python, not disk files. Can someone please post
`pycurl` code to do this,
or fast `urllib2` (not one-at-a-time) if tha... |
In memory database with socket capability
Question: Python --> SQLite --> ASP.NET C#
I am looking for an in memory database application that does not have to write
the data it receives to disc. Basically, I'll be having a Python server which
receives gaming UDP data and translates the data and stores it in the memory
... |
pylint PyQt4 error
Question: I write a program :
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def main():
app = QApplication([])
button = QPushButton("hello?")
button.show()
app.exec_()
if __name__=="__main__":
main()
the file na... |
Inserting multiple types into an SQLite database with Python
Question: I'm trying to create an [SQLite](http://en.wikipedia.org/wiki/SQLite) 3
database from Python. I have a few types I'd like to insert into each record:
A float, and then 3 groups of n floats, currently a tuple but could be an
array or list.. I'm not w... |
Measure time of a function with arguments in Python
Question: I am trying to measure the time of `raw_queries(...)`, unsuccessfully so far.
I found that I should use the timeit module. The problem is that I can't (= I
don't know how) pass the arguments to the function from the environment.
Important note: Before calli... |
Is there any Visual Studio-like tool for creating GUIs for Python?
Question: My girlfriend asked me if there was a tool (actually, an IDE) that would let
her create her GUI visually and edit functions associated with GUI-related
events with little effort.
**For example, she wants to double-click a button she just crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.