I'm trying to implement my own version of the 'cd' command that presents the user with a list of hard-coded directories to choose from, and the user has to enter a number corresponding to an entry in the list. The program, named my_cd.py for now, should then effectively 'cd' the user to the chosen directory. Example of how this should wo...
i built an appengine web app cricket.hover.in. The web app consists of about 15k url's
linked in it, But even after a long time of my launch, no pages are indexed on google.
Any base link place on my root site hover.in are being indexed with in minutes.
but i placed the same link home page of root site a long back. but its of no use.
c...
How can i convert decimal to Octal in Python2.6, for 1 to 100000? I wanna get this converted result as .txt too. Can someone help me?
...
I have 2 weeks to finish my final year project.I need a GUI IDE or a GUI framework compatible with PyDev and Eclipse.
I cannot spend time learning something cause the functionality is yet to be completed.I'm looking for very simple GUI for a simulation game.
...
I'd like to get the HTML elements highlighted as well as the MAKO / Python elements.
Thanks.
...
I'd like to convert a string of text, e.g., "User Name" into something which I can turn into part of a url, e.g., "User-Name." What's the fastest way to do a string replacement ("-" for " ") as well as make sure that characters are only [a-zA-Z0-9]?
...
Looking to store usernames and passwords in a database, and am wondering what the safest way to do so is. I know I have to use a salt somewhere, but am not sure how to generate it securely or how to apply it to encrypt the password. Some sample Python code would be greatly appreciated. Thanks.
...
Hi.
Is there any way to control links browser from python?
I need to make some bot, twill don't work on my page, Selenium need's X server.
Maybe other way to do it?
...
I'm trying to get zc.buildout to install Gunicorn from source. Using the following configuration:
[gunicorn]
recipe = collective.recipe.distutils
url = http://github.com/benoitc/gunicorn/tarball/master
results in the following error:
SystemError: ('Failed', '"/usr/bin/python" setup.py -q install --install- purelib="/mnt/hgfs/Project...
I have a function that is responsible for killing a child process when the program ends:
class MySingleton:
def __init__(self):
import atexit
atexit.register(self.stop)
def stop(self):
os.kill(self.sel_server_pid, signal.SIGTERM)
However I get an error message when this function is called:
Traceback (...
Hi,
I'm doing query like that:
SomeObject.objects.annotate(something=Avg('something')).order_by(something).all()
Now, I normally have an aggregate field in my model that I use with Django signals to keep in sync, however in this case perfomance isn't an issue so I thought I'd keep it simple and just use subqueries.
This approach, h...
Hi,
I've been wanting to learn python and do some NLP, so have finally gotten round to starting. Downloaded the english wikipedia mirror for a nice chunky dataset to start on, and have been playing around a bit, at this stage just getting some of it into a sqlite db (havent worked with dbs in the past unfort).
But I'm guessing sqlite ...
I found that you can't read from some sites using Python's urllib2(or urllib). An example...
urllib2.urlopen("http://www.dafont.com/").read()
# Returns ''
These sites works when you visit the site. I can even scrap them using PHP(didn't try other languages). I have seen other sites with the same issue - but can't remember the URL at t...
Hi guys,
I am a beginner in NLP and NLTK. I am very interested in NLP and hence
joined a weekend course on AI in some local institution, which requires me
to do a project for completion of the course, and I decided to do it in NLP. The problem is,the instructor is not good at all for this course (According to me she
is just a charlatan)...
Hello. I'm having trouble getting my list to return in my code. Instead of returning the list, it keeps returning None, but if I replace the return with print in the elif statement, it prints the list just fine. How can I repair this?
def makeChange2(amount, coinDenomination, listofcoins = None):
#makes a list of coins from an amoun...
Quite simply, is there a python equivalent to php's phpinfo();? If so, what is it and how do I use it (a link to a reference page would work great).
...
I've had a look around for the answer to this, but I only seem to be able to find software that does it for you. Does anybody know how to go about doing this in python?
...
I have the following lambda function:
f = lambda x: x == None and '' or x
It should return an empty string if it receives None as the argument, or the argument if it's not None.
For example:
>>> f(4)
4
>>> f(None)
>>>
If I call f(None) instead of getting an empty string I get None. I printed the type of what the function returned ...
Hi All,
I am writing a program that categorizes a list of Python files by which modules they import. As such I need to scan the collection of .py files ad return a list of which modules they import. As an example, if one of the files I import has the following lines:
import os
import sys, gtk
I would like it to return:
["os", "sys",...
I have one of my computers seeding a torrent file on port 45000. I am trying to write a small client in python (or perhaps perl) that helps me to determine the types of messages this client supports for which I need to perhaps do a handshake with the client. In Azureus, this is done using a call like peer.getSupportedMessages(). Is it po...