How would I go about checking if a domain name is registered? I was thinking about checking if it has a corresponding IP but it doesn't seem to work as well as I had hoped. Is there a solution in either PHP or Python that can check?
...
The particular case I have is like this:
I have a Transaction model, with fields: from, to (both are ForeignKeys to auth.User model) and amount. In my form, I'd like to present the user 2 fields to fill in: amount and from (to will be automaticly set to current user in a view function).
Default widget to present a ForeignKey is a selec...
Hello, I've got an e-book (viewable with isilo) in a pdb file. Is it possible to read it's contents with Python (perl, ruby, php)?
...
How to parse a custom string using optparse, instead of command line argument?
I want to parse a string that I get from using raw_input().
How can I use optparse for that?
...
I'm trying to count the number of tags in the 'soup' from a beautifulsoup result. I'd like to use a regular expression but am having trouble.
The code Ive tried is as follows:
reg_exp_tag = re.compile("<[^>*>")
tags = re.findall(reg_exp_tag, soup(cast as a string))
but re will not allow reg_exp_tag, giving an unexpected end of regular...
How do you convert a python time.struct_time object into a datetime.datetime object? I have a library that provides the first one and a second library that wants the second one...
...
I have Django Model with many fields which user must fill. If I'll create one ModelForm for this Model it will be big enough for one form. I want to split it using FormWizard. I think it's possible first to create forms dynamically and then create FormWizard using them.
Is this good approach or is there any better way?
...
I am trying to learn programming in python and am also working against a deadline for setting up a neural network which looks like it's going to feature multidirectional associative memory and recurrent connections among other things. While the mathematics for all these things can be accessed from various texts and sources (and is access...
I have read samples out of a wave file using the wave module, but it gives the samples as a string, it's out of wave so it's little endian (for example, '`\x00').
What is the easiest way to convert this into a python integer, or a numpy.int16 type? (It will eventually become a numpy.int16, so going directly there is fine).
Code needs t...
Dear Overflowns:
I have an executable whose input is contained in an ASCII file with format:
$ GENERAL INPUTS
$ PARAM1 = 123.456
PARAM2=456,789,101112
PARAM3(1)=123,456,789
PARAM4 =
1234,5678,91011E2
PARAM5(1,2)='STRING','STRING2'
$ NEW INSTANCE
NEW(1)=.TRUE.
PAR1=123
[More data here]
$ NEW INSTANCE
NEW(2)=.TRUE.
[etcetera]
In ...
Is there a more succinct/correct/pythonic way to do the following:
url = "http://0.0.0.0:3000/authenticate/login"
re_token = re.compile("<[^>]*authenticity_token[^>]*value=\"([^\"]*)")
for line in urllib2.urlopen(url):
if re_token.match(line):
token = re_token.findall(line)[0]
break
I want to get the value of the i...
It seems I can only load everything as uint8 type, just with the following two lines,
import scipy.io
X1=scipy.io.loadmat('one.mat')
all double precision numbers get transformed. I believe the creators of scipy
are aware of the fact that floating-point numbers are much more common...
So, what should I do?
Thank you!
...
Hello,
currently im making some crawler script,one of problem is
sometimes if i open webpage with PAMIE,webpage can't open and hang forever.
are there any method to close PAMIE's IE or win32com's IE ?
such like if webpage didn't response or loading complete less than 10sec or so .
thanks in advance
...
I'm working on an open-source project called python-graph. We've come to the point where our APIs are stabilising and we've realised that we need some user docs. We already have automatically generated Epydoc API reference documents, however I want to I want to create something more useful for beginner programmers who find the auto-gener...
I am having some trouble getting Python IO redirected to a console that I've allocated for my Win32 app. Is there a Python-specific stream that I need to redirect?
Here's more-or-less what I'm doing now (error checking removed, etc.):
int __stdcall WinMain(/*Usual stuff here*/) {
// Create the console
AllocConsole();
SetCon...
A normal urllib2 works fine:
>>> import urllib2
>>> r = urllib2.urlopen(u"http://bit.ly/4ovTZw")
>>> r.geturl()
'http://www.writing.com/main/handler/action/show_document/item_id/933413.mp3'
>>> r.headers.get("Content-Type")
'audio/mpeg'
But in appengine, the same code shows text/html.
def get(self):
r = urllib2.urlopen(u"http://b...
Hi everybody:
I am trying to add a Python script to into my project to obtain the build and marketing numbers directly from Git.
I have created a new target phase and that runs a script as explained in:
http://yeahrightkeller.com/2008/10/19/xcode-run-script-build-phase-tip/
And I have written a Python script that parses the program In...
I read that Python does not actually support 2D arrays but rather an array of an array. I understand the array of an array thing but what does it mean by supporting 2D arrays?
In C a 2D array is simply converted to a 1D array by doing some fancy math (Seen here). Are there languages that implement actual 2D arrays?
Thanks for the hel...
I'm trying to create a utility class for traversing all the files in a directory, including those within subdirectories and sub-subdirectories. I tried to use a generator because generators are cool; however, I hit a snag.
def grab_files(directory):
for name in os.listdir(directory):
full_path = os.path.join(directory, name...
BeautifulSoup newbe... Need help
Here is the code sample...
from mechanize import Browser
from BeautifulSoup import BeautifulSoup
mec = Browser()
#url1 = "http://www.wines.com/catalog/index.php?cPath=21"
url2 = "http://www.wines.com/catalog/product_info.php?products_id=4866"
page = mec.open(url2)
html = page.read()
soup = BeautifulSou...