text stringlengths 226 34.5k |
|---|
Is C, Java and Python a good combination for future?
Question: i just wanna be a programmer in the future, do you think, that i'm doing right
if i'm going to learn this combination (C\Java\Python)? I know Java well, C is
also on a good level. I just wanna be able to understand a low level code and
also be able to build... |
Python: Replacing certain Unicode entities with entities from dictionary
Question: I have read already much about the problem of backslash escaping in python
strings (and backslash recognition in Python in different encodings) and using
backslashes in regular expressions, but still cannot solve my problem. I would
high... |
Loops and totals in Python
Question: I am trying to write a program to draw a histogram of the lengths of words
present in a list, so far I am up the stage of increasing the number of words
present of a certain length by one every time the loop finds a word with that
certain length, at the moment I have:
... |
CTRL-C terminate in python
Question: Currently, I have an exe that I need to pass commands to thru python. The code
worked when it was by itself. When I merged that snippet with my final
program, it failed to work.
Basically, after the first two files upload using the program `shell_start`
(upload is `-f` in the progr... |
Converting a string of tuples to a list of tuples in Python
Question: How can I convert `"[(5, 2), (1,3), (4,5)]"` into a list of tuples `[(5, 2),
(1,3), (4,5)]`
I am using `planetlab` shell that does not support `"import ast"`. So I am
unable to use it.
Answer: If
[`ast.literal_eval`](http://docs.python.org/library... |
QWebKit - Run page's javascript function?
Question: Basically I want to go into my Router's settings,
set a checkbutton and than call a function on the page,
all programmatically.
I know all the javascript to do this,
and can do it via the Google Chrome console.
I can syntactically perform it through QWebKit, ... |
Connecting to Microsoft Dynamics CRM 2011 SDK from Python
Question: Has anyone had any luck connecting to the 2011 endpoints in Microsoft Dynamics
CRM 2011 using Python? I've installed SUDS and can grab the WSDL, but service
calls return 400 Bad Request. I'm sure it's because I'm not authenticated, but
I'm not quite su... |
Monte Carlo and Area -calculation
Question: It should be close to 0.3
$ cat monte.py
import random,math
density=int(1e6)
x = [random.uniform(0,1)*7*math.pi for _ in range(density)]
y = [random.uniform(0,1) for _ in range(density)]
i = [math.sin(xx)*math.cos(xx) > yy for (xx,yy) in zi... |
What code is executed when a class is being defined?
Question: When I import a module that has a class, what code is executed when that class
is first read and the class object created? Is there any way I can influence
what happens?
* * *
**Edit:** I realize my question might be a bit too general...
I'm looking for ... |
"IOError No such file or directory" for an image file that IS in the current directory
Question: I'm using Python Imaging Library and Tkinter. I am currently trying to display
an image as a label, and I'm getting the above exception. My 35 line source:
from PIL import Image, ImageTk
from Tkinter impo... |
Conversion from geographic to geomagnetic coordinates
Question: I'm trying to convert between geographic and geomagnetic coordinates. I've
found the following Prolog script, but I don't understand it enough to convert
it myself. The target language is Java, but anything understandable is fine
(C, Python, VB, whatever).... |
complex SOAP request prints single line response
Question: I am completely new to Python and Suds.In order to test different clients, I
succeeded in C#, java, perl and now term is about Python-suds...can some one
help... here is the client code----
from suds.client import Client
wsdl = 'http://www.cb... |
python libXML2 remove Item
Question: I am using libxml2 under python. Unfortunatly the python version of this
library is really badly documented and i founded just few example on the web
from there i could understand some of the method.
I managed the add a soon te a XML Node. Since this element should replace an
exist... |
Python C API unicode arguments
Question: I have a simple python script
import _tph
str = u'Привет, <b>мир!</b>' # Some unicode string with a russian characters
_tph.strip_tags(str)
and C library, which is compiled into _tph.so. This is a `strip_tags` function
from it:
PyObjec... |
Tornado datetime
Question: How would I create a datetime stamp from a clients offset? I have been messing
around with this all day. The idea is to have a user login and based upon
their timezone to create the cookie to expire after so long.
#!/usr/bin/env python
import tornado.auth
import to... |
python tkinter display animated GIF using PIL
Question: Is there any way to display an animated GIF in Tkinter using Python Image
Library?
I thought the [ImageSequence
module](http://www.pythonware.com/library/pil/handbook/imagesequence.htm)
would be the way to do it, but I don't know how to use it and if it's
possibl... |
Web2py + MS SQL Server 2008 R2 + LDAP Authentication HelloWorld application?
Question: I have been using Web2py in the awesome *nix environment for sometime along
with opensource RDMS (MySQL,Postgre,SQLLite,etc) for my personal projects.
For my workplace which is completely working in a .Net environment I need to
make... |
ImportError: No Module name Multiarray
Question: So I am using IronPython in PyDev and I am trying to import numpy. However,
when I am getting the following error:
Traceback (most recent call last):
File "C:\Users\Dan\workspace\Practice\src\practice.py", line 8, in <module>
File "C:\Python27\Lib\... |
Python Regular Expression OR not matching
Question: For some reason,
m = re.search('(<[^pib(strong)(br)].*?>|</[^pib(strong)]>)', '</b>')
matches the string, but
m = re.search('(</[^pib(strong)]>)', '</b>')
does not. I am trying to match all tags that are _not_
<... |
python sqlite3 error in FreeBSD 9
Question: Trying to install this ipython version. infact there's a django-starter
project which uses buildout for his needs.. And that scripts tried to get
ipython 0.11 with easy_install.I tried to grep everything out from this
package but there's no ipython mentioned in any files at a... |
Why does python keep buffering stdout even when flushing and using -u?
Question:
$ cat script.py
import sys
for line in sys.stdin:
sys.stdout.write(line)
sys.stdout.flush()
$ cat script.py - | python -u script.py
The output is right but it only starts printing once I hit... |
How to only print certain text using BeautifulSoup
Question: I am trying to pull some financial data for city governments using
BeautifulSoup (had to convert the files from pdf). I just want to get the data
as a csv file and then I'll analyze it in Excel or SAS. My problem is that I
do not want to print the "& nbsp;" t... |
Why I already installed pywin32 lib, but still got "ImportError: No module named win32com.client"
Question: I already installed the "Python for Windows extensions" library from here:
<http://sourceforge.net/projects/pywin32/files/pywin32/>
but when I import the "win32com.client" in my program, I still got the error
m... |
How to make an if loop of a file existence, in python?
Question: I'm trying to run a series of commands for two input files, but I want to
avoid doing the same thing if it has already been done. To make it more clear,
these are my commands:
from subprocess import call
import os.path
pathway ... |
how to remove an element in lxml
Question: I need to completely remove elements, based on the contents of an attribute,
using python's lxml. Example:
import lxml.etree as et
xml="""
<groceries>
<fruit state="rotten">apple</fruit>
<fruit state="fresh">pear</fruit>
<fruit sta... |
What would be the most efficient/clean way to deeply sort a multidimensional list in Python?
Question: Example:
From this list:
list = [[10, 9, 1], [2, 1, 1,], [4, 11, 16]]
I'd like to have:
print list
[[1, 1, 1], [2, 4, 9], [10, 11, 16]]
Is it possible with the _list.s... |
Can I find the path to the python executable from inside python?
Question: > **Possible Duplicate:**
> [How to get current python interpreter path from inside a Python
> script?](http://stackoverflow.com/questions/5927633/how-to-get-current-
> python-interpreter-path-from-inside-a-python-script)
The title pretty mu... |
Running Scrapy tasks in Python
Question: My Scrapy script seems to work just fine when I run it in 'one off' scenarios
from the command line, but if I try running the code twice in the same python
session I get this error:
"ReactorNotRestartable"
Why?
The offending code (last line throws the error):
c... |
Numpy Cimport error using cython
Question: I am trying to Cimport Numpy into a Python 2.7 shell from a `.pyx` file, but
it keeps giving me the same error:
I made a `.pyx` file called `numpyx` just to see if it was part of the bigger
code I was running, the file contains:
cimport numpy as np
a = np.a... |
What is the best way to sort list with custom sorting parameters in Python?
Question: I have a series of lists that looks like this:
li1 = ['a.1', 'b.9', 'c.8', 'd.1', 'e.2']
li2 = ['a.4', 'b.1', 'c.2', 'd.2', 'e.4']
How can I rearrange the items in each list so that the first item is
'b.someth... |
Jython random module produces different results to cpython
Question: I'm generating some test data using a known random seed. I want to use this
data from cpython and from jython. I've found that the data is different if I
use jython (2.5.2) vs cpython.
Boiling it down to a simple test, I can see that the PRNG is givi... |
How to add data to mongoDB in python
Question: I am a python noob (working with it for less than a few hours). I'm trying to
read in twitter data and store it in a mongo database, but I am getting the
following error:
Traceback (most recent call last):
File "twit_test.py", line 8, in on_receive
... |
Opening a java JAR file from python
Question: I am trying to open a JAR file from python and running into problems. I am
using..
import os
os.system(r"X:\file.jar")
it appears to open the window then it shuts right away, I know I am missing a
simple command but not sure what it is, thanks for t... |
python regex re.compile() match string
Question: Gents, I am trying to grab the version number from a string via python
regex...
Given filename: facter-1.6.2.tar.gz
When, inside the loop:
import re
version = re.split('(.*\d\.\d\.\d)',sfile)
print version
How do i get the 1.6.2 bit into ... |
Python check for valid email address?
Question: Is there a good way to check a form input using regex to make sure it is a
proper style email address? Been searching since last night and everybody that
has answered peoples questions regarding this topic also seems to have
problems with it if it is a subdomained email a... |
Subprocess completes but still doesn't terminate, causing deadlock
Question: Ok, since there are currently no answer's I don't feel too bad doing this.
While I'm still interested in what is actually happening behind the scenes to
cause this problem, my most urgent questions are those specified in update 2.
Those being,... |
Cannot create Python Object in .NET with IronPython
Question: Newly I started working with IronPython in .NET but as I saw some few examples
they're making engine with `Python.CreateEngine()` But the `Python` object
isn't loaded for me however I imported these references.
using IronPython.Hosting;
us... |
FFT filter vs lfilter in python
Question: I have some troubles when applying bandpass filter to signal in Python. Have
tried the following to things:
* Do the box window "by hand", i.e. do the FFT on the signal, apply the filter with a box window and the do the IFFT to get back to the time domain.
* Use the scipy.... |
python- construction of lattice which traps molecules - doesn't work right
Question: I have this problem :
> Create a program which constructs a lattice of one (1) dimension and 100000
> sites. In this lattice put at random positions a number of trap molecules,
> which will have concentration c. Put 1 particle in a ra... |
Compute the average of the same index in the list, python
Question: I have a list as follows:
A= [('1', 3), ('2', 7), ('3', 5), ('1', 7), ('2', 5), ('3', 1)]
From the list `A`, I would like to generate the output list like this:
Average = [('1', 5), ('2', 6), ('3', 2)]
Any tips... |
SWIG interfacing C library to Python (SWIG generated classes are cumbersome to use)
Question: I am using SWIG to generate Python language bindings to my C library. I have
managed to build the bindings and exported data structures, but I'm having to
jump through some hoops when using the library.
For example the C head... |
Alternatives to php for in-line web programming?
Question: I first learned web programming with php a while back. It has some features
that I find very helpful, but the overall language is not something I enjoy,
just as a matter of personal preference. I am wondering what alternatives I
could use to provide similar fun... |
Yaml file addressing in GAE using Python
Question: Here is the file structure :
--src
-----\app.yaml
-----\bl
-----\bl\calc.html
-----\calc.py
-----\Main.py
I want to get to this address "localhost/bl/calc.html" and here is my yaml
file:
- url: /bl
stat... |
Web-scraping JavaScript page with Python
Question: I'm trying to develop a simple web scraper. I want to extract text without the
HTML code. In fact, I achieve this goal, but I have seen that in some pages
where JavaScript is loaded I didn't obtain good results.
For example, if some JavaScript code adds some text, I c... |
How to log everything that occurs in a Python interactive shell session?
Question: I'd like to have real-time access to both interpreter input and error and
standard output. Preferably this information would be written to a file, so
that I can poll the file for changes after every interpreter command has been
entered. ... |
Python lxml the E-Factory
Question: I've been using the lxml "E-Factory" (aka. ElementMaker) for creating xml
documents. I'm trying to generate an xml document similar to this:
<url>
<date-added>2011-11-11</date-added>
</url>
However, using the E-factory, I'm not sure how to specify the d... |
How to Perform a HTTP Post "directly" in Python
Question: I do not know much about the difference between a HTTP Get and a HTTP Post so
I am hoping to get some information from those more knowledgeable then me.
I have written the following code:
<form action="https://na.leagueoflegends.com/user/login" m... |
Python one class per module and packages
Question: I'm trying to structure my app in Python. Coming back from C#/Java background,
I like the approach of one class per file. I'd like my project tree to look
like this:
[Service]
[Database]
DbClass1.py
DbClass2.py
[Mo... |
Python threading module import failure
Question: I'm trying to import the threading module, however, i just seem to get errors
for no good reason. Here is my code:
import threading
class TheThread ( threading.Thread ):
def run ( self ):
print 'Insert some thread stuff here.'
... |
Context manager for Python's MySQLdb
Question: I am used to (spoiled by?) python's
[SQLite](http://docs.python.org/library/sqlite3.html) interface to deal with
SQL databases. One nice feature in python's SQLite's API the "context
manager," i.e., python's `with` statement. I usually execute queries in the
following way:... |
Resources for working with Machine Learning in F#
Question: I have learned a Machine Learning course using Matlab as a prototyping tool.
Since I got addicted to F#, I would like to continue my Machine Learning study
in F#.
I may want to use F# for both prototyping and production, so **a Machine
Learning framework** wo... |
Number of seconds since the beginning of the day UTC timezone
Question: How do I find "number of seconds since the beginning of the day UTC timezone"
in Python? I looked at the docs and didn't understand how to get this using
`datetime.timedelta`.
Answer: Here's one way to do it.
from datetime import d... |
How to get filename when running mapreduce job on EC2?
Question: I am learning elastic mapreduce and started off with the Word Splitter example
provided in the Amazon Tutorial Section(code shown below). The example
produces word count for all the words in all the input documents provided.
But I want to get output for ... |
sys.exc_info or sys.last_*?
Question: Should I prefer
[`sys.exc_info()`](http://docs.python.org/py3k/library/sys.html#sys.exc_info)
over
[`sys.last_value`](http://docs.python.org/py3k/library/sys.html#sys.last_type)
and friends (`sys.last_type`, `sys.last_traceback`)?
Answer: Looking at the documentation of `sys.last... |
PyQt4 names showing as undefined in eclipse, but it runs fine
Question: I am using Eclipse 3.7.1 with the latest PyDev add-in for Python coding. I am
using PyQt4. At the top of my file I have:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
In addition, I have the PyQt4 tree included in th... |
Generating pdf-latex with python script
Question: I'm a college guy, and in my college, to present any kind of homework, it has
to have a standard coverpage (with the college logo, course name, professor's
name, my name and bla bla bla).
So, I have a .tex document, which generate my standard coverpages pdfs. It
goes s... |
Matplotlib - Grid arrangement subplots spacing
Question: I am trying to arrange a bunch of subplots in a grid like fashion. The problem
is that the number of subplots varies with user selection of what data to
plot. Right now I am trying to add plots this way:
l = len(clicked)
self.p=wx.... |
An issue with the soaplib hello world program
Question: I am trying to get this server to run however I keep getting an error:
server:
import soaplib
from soaplib.core.service import rpc, DefinitionBase
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import ... |
sort eigenvalues and associated eigenvectors after using numpy.linalg.eig in python
Question: I'm using numpy.linalg.eig to obtain a list of eigenvalues and eigenvectors:
A = someMatrixArray
from numpy.linalg import eig as eigenValuesAndVectors
solution = eigenValuesAndVectors(A)
ei... |
Using Celery with SQLAlchemy and Pyramid
Question: I'm creating the web app using Pyramid-1.2.1 with SQLAlchemy as database
backend.
Now I need to do some periodic tasks along with this app and I want to use
Celery as a task processor and SQLAlchemy as the message queue and the result
backend.
1) I've installed Cele... |
:: in strings in Python
Question: I've been learning Python and I must say I loved it. But as a new learners I
am having some other problems as well:
Could you guys tell me whether it is a feature of Python or the library of
itself.
I am checking how to connect to sqllite database and I came up with this
article and ... |
Simple way to query connected USB devices info in Python?
Question: How can we query connected USB devices info in Python? I want to get UID
Device Name (ex: SonyEricsson W660), path to device (ex: /dev/ttyACM0)
And also what would be the best Parameter out of above info to be used as
identifying the device whenever i... |
can't create django project using Windows command prompt
Question: if i run
django-admin.py startproject mysite
django-admin.py (which is located in `C:\python27\scripts/django-admin.py`)
will open in a file editor (now it opens in python ide, but in the past i had
pype so it would open in pype) so... |
SWIG/python array inside structure
Question: I've got a structure defined inside header.h that looks like :
typedef struct {
....
int icntl[40];
double cntl[15];
int *irn, *jcn;
....
When I init an object with this structure, I have access to integers/dou... |
Getting authenticationerror.login_cookie_required error while using Google adwords API with Python
Question: I am trying to use python to consume some adwords soap API, I am able to get
the auth token but when I try to make a get request I got the
authenticationerror.login_cookie_required error. Any ideas?
... |
ImportError: No module named bz2 for Python 2.7.2
Question: I'm using Python 2.7.2 on Ubuntu 11.10. I got this error when importing the
bz2 module:
`ImportError: No module named bz2`
I thought the bz2 module is supposed to come with Python 2.7. How can I fix
this problem?
EDIT: I think I previously installed Python ... |
Why wont Web.py let me run a server on port 80?
Question: Im trying to create a website with Web.py but its not letting me open a create
a socket on port 80 but it works on every other port.
I have port forwarded and all that so that's not the problem.
python main.py 80
but when I do this I get th... |
couchDB-Python storing Date Value
Question: I was following the CouchDb tutorial from
<http://packages.python.org/CouchDB/mapping.html>. This seems to be outdated
since the modules dont work as per the program. So I just re wrote the CouchDB
python script to store few values and here is my script. But when I lookup the... |
Python. Doing some work on background with Gtk GUI
Question: * **python 3.2.2**
* **gtk3 3.2.2**
* **python-gobject 3.0.2**
I'm trying to display a GUI and do some work in the background. As I
understand it should look something like this:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
... |
How to find form.has_errors OR form.errors and enable the error in the first place
Question: I have several related questions and post under one topic for clarity's sake.
# Django/django_bookmarks/urls.py
urlpatterns = patterns('',
(r'^$', main_page),
(r'^user/(\w+)/$', user_page)... |
String operations on xml nodes in Python
Question: I am reading an xml file and want to perform string operations on the node's
content.
import os
import elementtree.ElementTree as ET
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import tostring
xml_file = ... |
Django with wsgi sporadically fails with "Premature end of script headers:"
Question: I have a site that is running for months now on Apache2 and periodically it
will just hiccup with the following:
[Sat Nov 12 06:18:34 2011] [error] [client X.Y.Z.158] Premature end of script headers: sleepsoundly_wsgi.p... |
Can't load jinja2 with webapp2/Google App Engine
Question: I'm going through the GAE webapp2 tutorial (runtime 2.7) using
GoogleAppEngineLauncher on my Mac, and though I'm following everything
exactly, I keep on getting an error at the point where we import the Jinja2
module: [Using Templates - Google App
Engine](http:... |
python socket argument
Question: I have some problem in python's socket. I would like to write a class about
sync_file,and these are what I wrote.
import socket
class sync:
def send_file(path,Socket): #I would like to income two argument. First one is the file's path, and the second one is t... |
how do I tell cutplace about this check class
Question: I am trying to use the API in cutplace to build a custom check
<http://cutplace.sourceforge.net/api.html#writing-checks>
Using the included demo data and code I have tried to follow the manual, at
least until it ends abruptly.
useCutplace.py:
# Va... |
Convert values in CSV column to individual columns
Question: I have a CSV file with the following format:
ID | STUFF | Custom | Custom Value
1 | string1 | name1 | val1
1 | string1 | name2 | val2
1 | string1 | name3 | val3
2 | string2 | name1 | val4
2 | string2 | name3 | val5
... |
Python: How do I redirect output of os.system to python shell?
Question: I want to make a simple batch script using python using os.system. I am able
to run the commands just fine, but the output for those commands dont print to
the python shell. Is there some way to redirect the output to the python
shell?
Answer: Y... |
Gstreamer+python: adding and removing audio sources while pipeline is running
Question: I'm working on a sample **python** script, originally found here: [Adding and
removing audio sources to/from GStreamer pipeline on-the-
go](http://stackoverflow.com/questions/3899666/adding-and-removing-audio-
sources-to-from-gstrea... |
import python module when using mod_python
Question: i have been using imdbpy for some time. I was interested in making a very
basic webservice to return json data.
I have a basic system working earlier today however after a reboot i now get
the following error AssertionError: Import cycle in
/home/prog/www/imdb/imdb.... |
Modeling a linear system with Python
Question: I would like to simulate/model a closed-loop, linear, time-invariant system
(specifically a locked PLL approximation) with python.
Each sub-block within the model has a known transfer function which is given
in terms of complex frequency `H(s) = K / ( s * tau + 1 )`. Usin... |
Ignore case in glob() on Linux
Question: I'm writing a script which will have to work on directories which are modified
by hand by Windows and Linux users alike. The Windows users tend to not care
at all about case in assigning filenames.
Is there a way to handle this on the Linux side in Python, i.e. can I get a
case... |
Reading lines from a file
Question: I am writing a program to read lines of text from 5 files and compile the text
from these 5 files into respective lists.
However I am having a great deal of trouble getting the program to actually
read the text to a list, here is my code so far:
from random import ran... |
Moving specific files in subdirectories into a directory - python
Question: Im rather new to python but I have been attemping to learn the basics to help
in my research within geology.
Anyways I have several files that once i have extracted from their zip files
(painfully slow process btw) produce several hundred subd... |
Printing issue in Python
Question: I feel like an idiot for even asking this but does anyone have any idea why my
code is printing the list after every shuffle?
def shuffle(L, nswaps):
n = 0
for item in L:
while n < nswaps:
card_one = choose(L)
... |
Python: Files stop being opened at a certain point
Question: I've written the following program in Python:
import re
import os
import string
folder = 'C:\Users\Jodie\Documents\Uni\Final Year Project\All Data'
folderlisting = os.listdir(folder)
for eachfolder in folderlisting... |
Python3 - runpy.run_path not working on Ubuntu 10.10
Question: I have code like this:
import runpy
runpy.run_path('other.py', globals())
It works on my Windows Box with Python 3.2 but fails on the default Python3
installation (from the Repository) on my Ubuntu 10.10 machine with this
message:
... |
Running Fabric with Python script together
Question: I see most of the Fabric API are use together with function.
Example of file (sample.py):
from fabric.api import *
print "Hello"
def deploy():
with settings(hosts_string="Remote", user = "ubuntu", key_filename="/home/ubuntu/key.pe... |
Why does installing a python package break setuptools and causes pkg_resources to not be found?
Question: This is partly a question, partly my own findings on what I found to be the
issue when I encountered this error:
(cdbak)USER-MBP-2:.virtualenvs <YOUR_USER_NAME>$ pip
Traceback (most recent call ... |
How do I instrument my python code?
Question: I'm developing some web apps with the grok framework, and I want to know what
the framework is doing when serving a simple page.
So, what tools are out there to grab such data, and maybe, graph it?
Answer: Python has plenty of built-in reflectivity that could be used for... |
Why is an empty function call in python around 15% slower for dynamically compiled python code
Question: This is pretty bad micro-optimizing, but I'm just curious. It usually doesn't
make a difference in the "real" world.
So I'm compiling a function (that does nothing) using `compile()` then calling
`exec` on that cod... |
How I create a web server that can interact with mobile applications?
Question: Ok first of all I want to create a web server that can interact with php,
Mysql or mango db and mobile applications. What do you think is better to use
Java or Python? I would like some good articles about web servers and how to
interact wi... |
boost::python and set::erase -> weird behaviour
Question: I'm trying to store objects in a std::set. Those objects are
boost::shared_ptr<>, coming from the python environment. adding values to the
set won't cause any troubles. But when I try to erase a value, even though I'm
passing the very same reference, it won't wo... |
getting sin curve values using python
Question: I am looking to create a sin curve using python. I want a code to generate the
values in the form of a sine curve. Such that if i plot those values i should
get this curve. Can someone help me with this ? I should be able to differ the
number of values it takes to reach t... |
Python : Singleton class object to persist list between imports ? (Like django admin register)
Question: I want to have `dict / list` to which I can add values, just like models can
be added to the admin register in django !
My attempt : (`package -> __init__.py`)
# Singleton object
# __init__.... |
word compression function using regular expressions in python
Question: Can someone tell me why it seems I am not getting the right results using this
regular expression in this python code? I would have thought, for example,
that the initial vowel in the word "about" should not disappear. Thanks.
>>> se... |
xlrd "year is out of range" error, xldate_as_tuple
Question: I am trying to use the `xldate_as_tuple`function to covert a datetime and a
time value from two seperate cells in a spreadsheet into python datetime and
time. I intend to combine the currently seperate values into one python
datetime value for use later in my... |
wx.ListBox.HitTest not working on Mac
Question: The following code sample works under linux (ubuntu) and Windows XP, but not
under OSX.
import wx
class frame(wx.Frame):
def __init__(self,p=None):
wx.Frame.__init__(self,p)
self.box = wx.ListBox(self)
self.bo... |
pymysql callproc() appears to affect subsequent selects
Question: I'm attempting to transition a code base from using MySQLdb to pymysql. I'm
encountering the following problem and wonder if anyone has seen something
similar.
In a nutshell, if I call a stored procedure through the pymysql cursor
callproc() method a su... |
Python Crawler - AttributeError: Crawler instance has no attribute 'url'
Question: I'm trying to learn the classes in python:
#!/usr/bin/env python
# *-* coding: utf-8 *-*
import urllib2
from BeautifulSoup import BeautifulSoup as bs
class Crawler:
def visit(self, ur... |
Convert ASCII armored output to binary data
Question: How can I convert the following PGP message to binary data using Python 2.6?
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.0.7 (MingW32)
hQIOA68nz9GqU7SREAgAxWfwvpziO4N6KquxmeuYD/txfTceyXRZGVqAGFUGmOdE
+K9PCLp/+p3cFC8OcOZg8WReI4wlpYzg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.