Which are the most advanced frameworks and tools there are available for python for practicing Behavior Driven Development? Especially finding similar tools as rspec and mocha for ruby would be great.
How would I download files (video) with Python using wget and save them locally? There will be a bunch of files, so how do I know that one file is downloaded so as to automatically start downloding another one?
Thanks.
I am trying to host some files/rails app in the port 8080 for external access. For python I am using the SimpleHTTPServer module, and for rails, webrick. However, both of them does not work very well. I don't get the response back, and, sometimes, if I get it, it's VERY slow. Nevertheless, apache works very well on the port 8080 (i am not running them at the same time). What is going on?
I've been hunting around for a Python CouchDB tutorial and haven't been able to find anything very thorough. The only thing I've really found is this site, which I haven't gotten to work because I keep getting a 'connection refused' error when I try to create a database.
Does anyone know where I would look for a tutorial to help me with this?
Can anyone point me to some documentation on how to write scripts in Python (or Perl or any other Linux friendly script language) that generate C++ code from XML or py files from the command line. I'd like to be able to write up some xml files and then run a shell command that reads these files and generates .h files with fully inlined functions, e.g. streaming operators, constructors, etc.
Hi,
I'm trying to send a Python list in to client side (encoded as JSON), this is the code snippet which I have written:
array_to_js = [vld_id, vld_error, False]
array_to_js[2] = True
jsonValidateReturn = simplejson.dumps(array_to_js)
return HttpResponse(jsonValidateReturn, mimetype='application/json')
So my question is how to access it form client side, can I access it like this:
jsonValidateReturn[0]
or how I assign a name to the returned JSON array in order to access it?
I want to do a very simple webserver in python able to receive XML document over HTTP and then to send as response XML document.
Do you have any example?
just to understand How arrange the work...
many thanks!
Hi all
I have the following 4 arrays ( grouped in 2 groups ) that I would like to merge in ascending order by the keys array.
I can use also dictionaries as structure if it is easier.
Has python any command or something to make this quickly possible?
Regards
MN
# group 1
[7, 2, 3, 5] #keys
[10,11,12,26] #values
[0, 4] #keys
[20, 33] #values
# I would like to have
[ 0, 2, 3, 4, 5, 7 ] # ordered keys
[20, 11,12,33,26,33] # associated values
The topic title pretty much says it all. Does anyone know how the built in dictionary type for python is implemented? My understanding is that it is some sort of hash table, but I haven't been able to find any sort of definitive answer.
I'm cocking this up and it should be really simple but the value of sortdate is none (note im only doing this because converting a string to a date in Python is a bugger).
DateToPass = str(self.request.get('startdate'))
mybreak.startdate = DateToPass
faf = DateToPass.split('-')
sortdate = str(faf[2] + faf[1] + faf[0])
That should work? but its just being stored as null though the datetopass is being stored fine.
I would like to know if there is something similar to PHP natsort function in python?
l = ['image1.jpg', 'image15.jpg', 'image12.jpg', 'iamge3.jpg']
l.sort()
gives:
['image1.jpg', 'image12.jpg', 'image15.jpg', 'iamge3.jpg']
but I would like to get:
['image1.jpg', 'iamge3.jpg', 'image12.jpg', 'image15.jpg']
I want to print in the terminal with colors ? how can I do that in python ?
Another questions what is the best character that when it is printed it look like a box [brick] ?
I want to print colored blocks, it is part of game :)
I am looking for a good Tree data structure class. I have come across this package, but since I am relatively new to Python (not programming), I dont know if there are any better ones out there.
I'd like to hear from the Pythonistas on here - do you have a favorite tree script that you regularly use and would recommend?
To learn from good examples, what are the best open source Google App Engine applications out there?
I don't care if it is Java or Python based.
Please one app per answer. Feel free to add a link to the live app (if there is) and to the project page.
How can I combine 2 ints to a single 32bit IEEE floating point ? (each of the 2 ints represent 16 bit)
And in the opposite direction: How can I transform a python float into 2 16 bit ints?
(I need this because of modbus protocol - where 2x16 bit registers are treated as single 32 floating point number)
I have a shell that runs CentOS
For a project I'm doing I need python 2.5+ but centOS is pretty dependent on 2.4
From what I've read a number of things will break if you upgrade to 2.5
I wan't to install 2.5 separately from 2.4 but I'm not sure how to do it. So far I've downloaded the source tarball, untarred it and did a ./configure --prefix=/opt which is where I want it to end up. can I now just make, make install ? or is there more?
I want certain functions in my application to only be accessible if the current user is an administrator.
How can I determine if the current user is in the local Administrators group using Python on Windows?
I am trying to create my own class of dictionary in python 3 which has a field of dict variable and setitem and getitem methods. Though, it doesnt work for some reason. Tried to look around but couldn't find the answer.
class myDictionary:
def __init(self):
self.myDic={}
def __setitem__(self, key, value):
self.myDic[key]=value
I'm getting:
'myDictionary' object has no attribute 'myDic'
Any ideas? :)
I am looking to make a python script be unique in the sense that it can only run once at a time. For example if I run the script and open another session of the same script a second time and the first session is still running, then the second session will just exit and do nothing. Anyone knows how I could implement this?
Is there any way to run one last command before a running Python script is stopped by being killed by some other script, keyboard interrupt etc.
Thanks for your help!
I am looking to make a python script be unique in the sense that it can only run once at a time. For example if I run the script and open another session of the same script a second time and the first session is still running, then the second session will just exit and do nothing. Anyone knows how I could implement this?
I am looking for a GUI python module that is best suited for the following job:
I am trying to plot a graph with many columns (perhaps hundreds), each column representing an individual. The user should be able to drag the columns around and drop them onto different columns to switch the two. Also, there are going to be additional dots drawn on the columns and by hovering over those dots, the user should see the values corresponding to those dots. What is the best way to approach this?
What is the best way to store the cards and suits in python so that I can hold a reference to these values in another variable?
For example, if I have a list called hand (cards in players hand), how could I hold values that could refer to the names of suits and values of specific cards, and how would these names and values of suits and cards be stored?