how can i determine if anything at the given url does exist in the web using python? it can be a html page or a pdf file, shouldnt be matter.
ive tried the solution written in this page http://code.activestate.com/recipes/101276/
but it just returns a 1 when its a pdf file or anything.
...
How do I convert a NumPy array to a Python array_like structure (for example [[1,2,3],[4,5,6]] ), and do it reasonably fast?
...
Does a library or script exist to convert between NumPy and JPype arrays?
...
I'm running a database server in a Linux VM (Ubuntu 9.10) under VMware Fusion, but coding Django on the Mac side. Installing mysql-python requires that MySQL is installed on the Mac for compiling _mysql.so into site-packages.
However, after this is done, I have no further use for MySQL on the Mac side, and would rather just delete it. O...
Hello everybody!
How can i cut off the last empty space?
a = ['Hello ','everybody ','! ']
for i in range(len(a)):
a[i,-1]=''
print a
...
I'm hacking a security system DVR so I can add motion capture and other fun features in python (version 2.6). One of the functions I was able to decompile from java and convert to python was the following:
def ToInt(abyte0, i):
if(abyte0[i] >= 0):
j = abyte0[i]
print "A " + str(j)
else:
j = 256 + abyte0[i]
if a...
How can I delete the \n and the following letters? Thanks a lot.
wordlist = ['Schreiben\nEs', 'Schreiben', 'Schreiben\nEventuell', 'Schreiben\nHaruki']
for x in wordlist:
...?
...
Haven't Python iterators got a hasNext method?
...
I don't want to use *args or **kwargs since I can't change function declaration.
For example:
def foo( a, b, c ) """Lets say values passed to a, b and c are 1,2 and 3 respectively"""
...
...
""" I would like to generate an object preferably a dictionary such as {'a':1, 'b':2, 'c':3} """
...
...
Can anyone suggest a way...
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 calling raw_queries, we have to execute phase2() (environment initialization).
Side not...
In my working python directory I create:
packagename/__init__.py
packagename/modulename.py
test.py
In modulename.py I create some empty class:
class Someclass(object):
pass
in test.py:
import packagename
packagename.modulename.Someclass()
Why I can't call packagename.modulename.someclass() in test.py ?
AttributeError: 'modul...
Is there a way to sort the entries in a Tk Treeview by clicking the column? Surprisingly, I could not find any documentation/tutorial for this.
...
Hello, I have a question about splitting up a main.py file.
right now, I have everything in my main.py. I have no other .py files. And I always have to scroll long lines of code before reaching the section I wish to edit.
How do I split it up?
(i'm going to have more than 20 pages, so that means the main.py will be HUGE if I don't spl...
I am confused because there are a lot of programms. But i am looking something like this. I will type a melody like "a4 c3 h3 a2" etc. and then i want to hear this. Does anybody know what i am looking for?
thanks in advance
...
Hi, I am very new to python. I am trying to write a program that will click the mouse at (x, y), move it to (a, b), and then wait until the color under the mouse is a certain color, lets say #fff. When it is that color, it clicks again and then repeats.
I cannot find a good API for mouse related stuff for python.
...
Hi guys!
I have two simple Python files: client.py and server.py. The client simply sends the text you type to the server, via UDP socket.
The port assigned and listened to is 21567, BUT... the line reading:
print "\nReceived message '", data,"' from ", addr
in server.py outputs the addr to be something looking like this: ('127.0.0...
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 created and immediately see (and edit) the code associated with that button's on-click event. I believ...
I'm writing an open source program (key-train) in Python and GTK (with Cairo) and I would like to use some more attractive fonts. I was hoping that it would be possible to load a ttf font from within the program and just use it (instead of installing it), but I haven't been able to figure out how to do this.
...
I'm just starting to learn python... so bear with me please
Why is it giving me a Invalid Syntax error with this block of code
def InvalidArgsSpecified:
print ("*** Simtho Usage ***\n")
print ("-i Installs Local App,, include full path")
print ("-u Uninstalls Installed App,include ID or Name")
print ("-li Lists all inst...
I'm trying to write a simple app that lets a user grant my code permission to write to her page's Facebook stream. As I understand it, it should be as easy as:
Have the user click on a button that launches a popup containing the a page in my Facebook app.
In that page, they click on something that grants stream_publish to my app and a...