3,386 Posted Topics
| |
Re: Raw binary bits is commonly used also selecting which Genetic Algorithm to perform. [url]http://en.wikipedia.org/wiki/Genetic_algorithm[/url] Probably not what you are looking for, though. | |
Re: nh[17:18] is list slice, not character. nh[17] is 18th character. I do not also find the meaning of your variables intuitive or line spacing reasonable. | |
As in C++ was some question about speed of simple hard disk based lookup, here is a version of unscramble program completely HD based lookup, which gives all possible candidate words for multiword anagram. Program is not sensitive for case of words but does not ignore special characters like ' … | |
Re: I would actually use a shell variable set and exported when starting each desktop. I would then use this saved username for current desktop (screen) to invoke browser, probably by having a statup script for browser using su with the shell variable name to open passed in url in a … | |
Re: 3eOjUn has close statement inside the loop, please unindent it out of the loop. | |
Re: Compare the expected results with the input, how would you find the result by hand? | |
Re: Could you post short code example with this problem, to make it more clear what you mean? | |
| |
Re: The doc is quite long and thorough, but should be helpfull: http://python.net/crew/theller/ctypes/tutorial.html#passing-pointers-or-passing-parameters-by-reference | |
Re: > # "parts[3] =" sets the 3rd index of the list 'parts' 4th index parts[3] ie parts at index 3. > # 8 = 1000 0x1 = 0001; the output would be 1001 == 9; parts[9] now equals '9' No int by itself turns number in decimal not binary | |
Re: Created dictionary of values a as key. | |
Re: Announce not anagram and break out of loop or return False, otherwise announce 'is anagram' or return True **after** the loop. Middle letter does not matter as it can be anything. Do not use l for variable name as it looks like I or 1. Line 2 should be s=str(s) … | |
Re: How about running the code by double click or from CMD window? | |
Re: Object is not defined, maybe it should be `object`? | |
Re: I would think little if Library can be borrowed. | |
Re: You are reading filename and dirname you show the dialog, those lines must be inside if block. 'ab' is strange mode to open file you only read. Also there is not defined variable 'self.edit'. | |
Re: I have no experience, but I would start with http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/ | |
Re: I think that fastest way would just iterate once through the database and compare key of sorted digits. | |
Re: Can not make much of your code, except that after fixing numerous indention error and putting one `pass` to def without statements. I got it run and after giving it one random text data file as input, it complained of KeyError. Why is `three` defined again for each iteration of … | |
Re: check start of line with startswith method. It can take tuple of line starts, not only single string. | |
Re: Here simple one, if you use Linux or similar, add appropriate Exception type to mkdir except import os import webbrowser def process(fn): with open(fn) as infile, open('./output/'+fn, 'w') as outfile: outfile.write(next(infile)[:26] + '\n') for line in infile: if '.txt' not in line: break else: outfile.write(line.rsplit('.txt',1)[0].rsplit(None,1)[0]+'\n') webbrowser.open('./output/' + fn) try: os.mkdir('./output') … | |
Re: > If there are any scandinavians around, you'll like this medieval tech support (also with english sub-titles): OK here is the [absolute classic from Finland by Spede](http://www.youtube.com/watch?v=gmhseAm173A) (now deceased, unfortunately) about more modern thing: Hardware store. Language is unfortunately only Finnish, but art is without language, isn't it? I think … | |
Re: file as variable name is bad odea, and truncate call does not make sense, but what is your question? | |
Re: Your code does not make any kind of sense, what image at line 20? What enhancer at same line? | |
Re: No, but you are welcome to tell us and we tell if it looks right or not. | |
Re: console part does nothing, it is just console interface and does repeated compilations of very questionable code in calc function. | |
Re: I do not know, but maybe you could catch how I do here in my Mandelbrot code (another version in Code snippets: http://www.daniweb.com/software-development/python/code/371844/mandelbrot-with-tkinter-and-shedskin ) version, which zooms the old image before calculating more exact picture: """ class for Python Tkinter for Mandelbrot set compile modules with shedskin for best performance … | |
Re: I like http://www.diveintopython.net/ if you are already programmed it might fit you. With django you are out of luck if you learn Python3 https://docs.djangoproject.com/en/1.4/releases/1.4/ | |
Re: I run the code without problem, but it did crash when given empty string as response. | |
Re: I reported this bug earlier, and the answer then was that it was Googles' fault, so good to know that you got influence there now. ;) | |
Because of [C++ code snippets not dealing with multiple +-](http://www.daniweb.com/posts/jump/1829367) in sequence (or even negative number) in expressions, I post this, as it is so much easier for me than C/C++. EDIT: Fixed signs together with '(' issues and '+' at beginning removing without lstrip, removed separate now unused '(' … | |
This is bit funny code as you can first read from this excellent response: http://www.daniweb.com/software-development/python/threads/427341/custom-types-in-a-simple-way#post1828718 why should you not use it, even it maybe feels useful. Anyway I got curious to see how type signature could be implemented, even using it would generally just be stupid way of slowing down … | |
![]() | Re: search tic tac toe python in daniweb search or browse the Code Snippets for example(s). |
Re: incorrect line is actually previous line, replace it with print("You got", right * 100 / len(questions),"% right out of", len(questions)) | |
Re: I do not see any error message in your post. | |
Re: Good subject, unfortunately, when I tested, it only added some () for return, nothing else and did not fix bad indention (done by purpose to test the code). | |
![]() | Re: print is statement in Python 2, and brackets around single value do nothing, so basically both are Ok in Python2. In Python3 print is function, which is usefull. The same style of printing can be activated in Python2 by from __future__ import print_function So the first version fails in Python3. … |
![]() | Re: You have unnecessary variables, when you should use sequence and loop: from random import choice sentence = [ ("I", "The stupid cheeser", "He", "She", "The pirate personperson"), ("killed", "ate", "vomited" "ate", ":)'ed"), ("the stupid cheeser2", "the moldy cheese", "the cow") ] for values in sentence: print choice(values), print '.' You … ![]() |
Re: User input can not be the whole range use `in`. Your indention is off for the if statement in lines 12-17. | |
Re: Collect the info to dictionary and write each key to it's own file. f = ["""\ <ticker>,<date>,<open>,<high>,<low>,<close>,<vol> A,20120116,36.15,36.36,35.59,36.19,3327400 AA,20120116,10.73,10.78,10.53,10.64,20457600 """, """\ <ticker>,<date>,<open>,<high>,<low>,<close>,<vol> A,20120117,26.15,36.36,35.59,36.49,3327400 AA,20120117,10.73,20.78,10.53,10.64,20457600 """ ] collect = dict() for day in f: for line in day.splitlines()[1:]: key, d = line.split(',', 1) collect.setdefault(key, []).append(d) for key, info in sorted(collect.items()): print(key) … | |
Re: Your code is really bad, but about your question: you should use `not in` not !=. You should start over and use list, not zillion simple variables. | |
Re: http://edn.embarcadero.com/article/32770 >The XMLDoc tool requires a number of supporting tools: >Delphi 2005 or later The XMLDoc tool. If this was not included in your copy of Delphi 2005, you can download it from Code Central. **Python (tested with Python 2.3)** *Joining of my first and last languages ;)* | |
Re: see -not swich for find and take out r from rm to remove one by one. That would leave directories there, however. | |
Re: Have you learned recursion? I think you could reverse an empty list quite easily wouldn't you? You just figure out how to reverse the list consisting on first node and rest of list reversed. Non-recursive reversing requires just that you remember the previous node and consider carefully corner cases like … | |
![]() | Re: So you should do something like this: include <stdio.h> int main() { int i = 5; printf("%d", i++); printf("%d", i++); printf("%d", ++i); getchar(); } Output: 568 Then you have clear code points for expressions. Not that I would call postincrement and right after preincrement to be good style, better: #include … |
Re: Maybe teachers should be Teacher object from cleaned data, models.Model has save method? https://docs.djangoproject.com/en/dev/topics/forms/modelforms/ | |
Re: > // e/f = (a/b) / (e/f) = (b * c) / (a * d) e/f = (a/b) / (c/d) = (a/b) * (d/c) = (a * d) / (b * c), you mean? | |
Re: You should post complete functional class not part snipped, which is not even correctly indented. you should also show how you are instantiating the class and the Tkinter, as you are unsure if you are doing it correctly. | |
Re: Or you must open the script and run it in Ui of pythonanywhere. |
The End.