I have been developing some Django app and there's some duplicated code for different Models. I'd like to create a generic table template and pass the Model class, a list of model instances, and Form classes to it so it can render the page and generate the forms to add/delete elements. Then create some generic add/delete views to work wi...
my integer input is suppose 12345 , i want to split and put it into an array as 1,2,3,4,5 . How will i be able to do it?
...
This gets me into difficult time (sorry, i am still very new to python)
Thank you for any kind of help.
The error
print Student.MostFrequent() TypeError: unbound method
MostFrequent() must be called with
Student instance as first argument
(got nothing instead)
This Student.MostFrequent() is called all the way in the end (l...
How do you open https url in Python?
import urllib2
url = "https://user:[email protected]/path/
f = urllib2.urlopen(url)
print f.read()
gives:
httplib.InvalidURL: nonnumeric port: '[email protected]'
Thanks in advance,
Etam.
...
I want to check whether the given string is single- or double-quoted. If it is single quote I want to convert it to be double quote, else it has to be same double quote.
...
I want something like BaseHTTPRequestHandler, except that I don't want it to bind to any sockets; I want to handle the raw HTTP data to and from it myself. Is there a good way that I can do this in Python?
To Clarify, I want a class that receives raw TCP data from Python (NOT a socket), processes it and returns TCP data as a response (...
Hi,
I'm trying to make a query function that accepts two datetime.date object(start_date and end_date), and return all records with a related field that's between start_date and end_date.
However, I found nothing like a between function in the web2py manual, so I implement it this way:
for o in objects:
# notice that...
I'm playing around with the XCF active memory server. Is there a python library to access the contents of the active memory server?
Related:
How to write data to the ActiveMemory Server used in the XCF system?
...
I'm newbie in Python, but this question is not a homework (actually this code helps to generate RSS on my Subversion server).
I have an array of strings in the info_lines variable. And I want to replace each occurrence of the bug ID. My current code looks like the following:
for ln in range(3, len(info_lines)): # skip two strings since...
what's the way to do in python the following in C++?
B* b = new D();
b->virtual_fn();
Which would call virtual_fn in D. Are there a form of references to do this?
...
In app engine there a way to use templates a bit more like php/javascript(document.write)?
for instance i would rather do:
<html>
<python>
print "Hello world"
</python>
</html>
rather than all the {IF } {ELSE } django stuff.
...
In python how do I check if its a weekday (Monday - Friday) and the time is between 10 AM to 3 PM?
...
in a string suppose 12345 , i want to take nested loops , so that i would be able to iterate through the string in this following way :-
1, 2, 3, 4, 5 would be taken as integers
12, 3, 4,5 as integers
1, 23, 4, 5 as integers
1, 2, 34, 5 as integers
...
And so on. I know what's the logic but being a noob in Python, I'm not able to f...
I need help with importing a file and converting each line into a list.
An example of the file would look like:
p wfgh 1111 11111 111111
287 48 0
65626 -1818 0
4654 21512 02020 0
The first line beginning with p is a header and the rest are clauses.
Each clause line must begin with a series of at least two integers and finish with a z...
Hi All
I am having a problem installing the Python MySQL connector (MySQL-python-1.2.3c1) on my Mac OSX Snow Leopard.
System State
I have manually compiled an installed:
mysql-5.1.41
This seems to work fine, as I can create and query a database from the commandline.
I have compiled:
MySQL-python-1.2.3c1
I first set the following in ...
I have found that the same mod operation produces different results depending on what language is being used.
In Python:
-1 % 10
produces 9
In C it produces -1 !
1) Which one is the right modulo?
2) How to make mod operation in C to be the same like in Python?
Thank you in advance!
...
I'm interested in learning how to Doctests and Unit tests in a more Agile / BDD way.
I've found a few tutorials that seem reasonable, but they are just thumbnails.
What I would really like to see is the source code of some Django projects that were developed BDD style.
The things I'm unclear about are how do you handle request objects e...
I am only going to post the portion where the problem is at, the program has no error (all the codes are valid except for this raw_input problem)
I tested with search_function(1) and etc and it worked.
But if I do this while loop, it doesn't print anything.
Example output:
Enter a number to print specific table,
or STOP to quit:...
I am attempting to add functionality to my Django app: when a new post is approved, I want to update the corresponding Facebook Page's status with a message and a link to the post automatically. Basic status update.
I have downloaded and installed pyfacebook - and I have read through the tutorial from Facebook. I have also seen this s...
Hi,
I've started building an app with Flex/Air but am getting sick of it's clunkyness.
The app that I'm building has similar behaviour to Prezi (www.prezi.com) but in a completely different field.
I'm looking for something on the desktop which has flex like capabilities, such as drawing vectors then zooming in/out, rotating etc, gui w...