Number in python - 010
When using the interactive shell: print 010 I get back an 8. I started playing around using other numbers having zeroes before (0110 = 72, 013 = 11) but I could not figure it out... What is going on here? ...
When using the interactive shell: print 010 I get back an 8. I started playing around using other numbers having zeroes before (0110 = 72, 013 = 11) but I could not figure it out... What is going on here? ...
How would you replace these tags with actual data: [|RSSITEMS:] [|RSSITEM:TITLE|] [|RSSITEM:CONTENT|] [|END:RSSITEMS|] [|RSSITEMS:] starts loop at the top and ends its [|END:RSSITEMS|] [|RSSITEM:TITLE|] and [|RSSITEM:CONTENT|] should be replaced with data from rss feeds. Feed data is already in database. Can not use django temp...
i have a python class like so: class TAG_Short(NBTTag): def __init__(self, value=None): self.name = None self.value = value def __repr__(self): return "TAG_Short: %i" % self.value This tag is filled out at runtime, but i'd also like to be able to use it like: mytag = TAG_Short(3) mycalc = 3 + ( mytag ...
This is about the Format Localization feature that was implemented in Django 1.2. In order to use this feature, you must add a localize=True parameter to all your form fields. I am trying to implement this localization in my app but the problem is that I am creating my forms dynamically by using the inlineformset_factory method that Dja...
Hello, am using xlwt module to create xls file with multiple sheets and i want to display Content disposition with the created file. wbk = xlwt.Workbook(encoding='utf-8') sheet = workbook.add_sheet('sheet1') and then response.headers['Content-Type'] = \ gluon.contenttype.contenttype('.xls') response.headers['Content-disposi...
Hi, I have a set of data and I want to compare which line describes it the best (polynomes of different orders, exponential or logarithmic). I use Python and Numpy and for polynomial fitting there is a function polyfit(). But I found no such functions for exponential and logarithmic fitting. Are there any? Or how to solve it otherwise...
I want to know how to call a function after a certain time. I have tried time.sleep() but this halts the whole script. I want the script to carry on, but after ???secs call a function and run the other script at the same time ...
I would like to find out if a window has focus. I am using pyGTK and would be helpful to us that but have got some Xlib in my script aswell. I've used: self.window.add_events( gdk.FOCUS_CHANGE_MASK ) # It took me ages to research this self.window.connect("focus-in-event", self.helloworld) but this gives me the event every time the win...
ORM tools are great when the queries we need are simple select or insert clauses. But sometimes we may have to fall back to use raw SQL queries, because we may need to make queries so complex that simply using the ORM API can not give us an efficient and effective solution. What do you do to deal with the difference between objects ret...
Already searched on google... doesnt seem to be there... help! ...
I was reading on web2py framework for a hobby project of mine I am doing. I learned how to program in Python when I was younger so I do have a grasp on it. Right now I am more of a PHP dev but kindda loathe it. I just have this doubt that pops in: Is there a way to use "Vanilla" python on the backend? I mean Vanilla like PHP, without a ...
Hello I am trying to import from django.http import HttpResponse, but I am getting the following exception: ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. Could anyone help me please? Thanks in advance ...
In the following code: a = 'a' tup = ('tu', 'p') b = 'b' print 'a: %s, t[0]: %s, t[1]: %s, b:%s'%(a, tup[0], tup[1], b) How can I "expand" (can't figure out a better verb) tup so that I don't have to explicitly list all its elements? NOTE That I don't want to print tup per-se, but its individual elements. In other words, the followin...
Hello, I recently learned Python and want to do a project just to get my hands dirty and let the knowledge settle. So I was thinking to create a simple Document Management System in Python because I have another project written in Java which needs it. I want the two to be linked by SOAP so the DMS will be a web service. I need the DM...
hello! i read a lot in that forum, but i couldn't find a proper way to add all items to my dictionary... So maybe someone can help me! first a explanation: rows = cur.fetchall() columns=[desc[0] for desc in cur.description] GID_Distances = {} if len(rows) > 0: for row in rows: items = zip(columns, row) GID_Distance...
I know it can be achieved by command line but I need to pass at least 10 variables and command line will mean too much of programming since these variables may or may not be passed. Actually I have build A application half in vB( for GUI ) and Half in python( for script ). I need to pass variables to python, similar, to its keywords arg...
I am using response.headers['Content-Type'] = gluon.contenttype.contenttype('.xls') response.headers['Content-disposition'] = 'attachment; filename=projects.xls' to generate save as dialog box. Is there a way to get the selected path by the user? ...
I am looking for a way given an English text count verb phrases in it in past, present and future tenses. For now I am using NLTK, do a POS (Part-Of-Speech) tagging, and then count say 'VBD' to get past tenses. This is not accurate enough though, so I guess I need to go further and use chunking, then analyze VP-chunks for specific tense ...
I'm having some trouble with the procedure below. First pass through the procedure, everything appears to work OK. Subsequent passes, the labels overwrite the previous label w/o erasing, plus the initial loop that hides the buttons doesn't appear to function. def drawbutton(self, event): rbuttons = [ wx.RadioButton(self,-1,'x...
I'm working on a logging app in Django to record when models in other apps are created, changed, or deleted. All I really need to record is the user who did it, a timestamp, a type of action, and the item that was changed. The user, timestamp, and action type are all easy, but I'm not sure what a good way to store the affected item is be...