226 Posted Topics
Re: Should be this: [CODE]d1 = dict() d1[0] = 1 d1[1] = 8 d1[2] = 8 maxValue = max(d1.values()) #<-- max of values print [key for key in d1 if d1[key]==maxValue][/CODE] | |
Re: I see you are working with Drosophila genetics. I'm not sure what you are trying to do.. can you explain it further? | |
Re: [CODE]print(data_list[1][0])[/CODE] | |
Re: I think the server processing speed would determine much of that. Also the speed of you LAN network, which you can test with LAN Speed Test [URL="http://www.totusoft.com/downloads.html"]http://www.totusoft.com/downloads.html[/URL] | |
Re: [QUOTE=ultimatebuster;1278469]I'm kind of confused over the iterator object/concept and the yield statement and its usage. According to my understanding, all the python sequence are iterators, as they don't need the classic [icode=java]for (int i=0; i<list.length; i++)[/icode] to iterate through lists/arrays. Am I correct over this? Am I missing anything? Also … | |
Re: Is this what you are trying to do? [CODE]sys.stdout.write("123: The metro polis\\n")[/CODE] | |
Re: That indicates that the .csv file has it in scientific notation. No string-number conversions exist there. also this code [icode]L = ''[/icode] is useless. L is not "declared" as a string. Python doesn't do that. If L is first a string, it doesn't mean it will always be a string. … | |
This is not my code! Taken from [URL="http://stackoverflow.com/questions/3230978/code-golf-four-is-magic/3231355#3231355"]this SO post[/URL]. You can use this to get the number of letters in the English representation of an integer, from 0 to 99. So for example 5 (five) is [icode]len("five")[/icode] which is 4. | |
Re: [QUOTE=tonyjv;1274972]You did not get rid of those un-Pythonic getters and setters.[/QUOTE] Yea, it would be doing us a favor if you removed them. They are quite painful to my eyes. | |
Re: [QUOTE=wolfeater017;1273575]cx-freeze 3.1 will work with python 3.0 right[/QUOTE] It will surely work with the latest version - Python 3.1.2 | |
Re: [CODE]while True: fname = raw_input("File name: ") try: fhand = open(fname) break except IOError: print "File {0} cannot be opened. Try again.".format(fname)[/CODE] | |
Re: Or you can do something like [CODE]while True: #... #... if overwrite = 'y': #... break[/CODE] | |
Re: Why do you have so many getter and setter methods? You don't need them, so I recommend removing them. Python has no need for that kind of getters and setters. | |
Re: You can use Regular Expressions. Search the file for that pattern, get the "guid" number, increment it by one, then write it. I haven't done regex in a while, so I'm not sure about the syntax. | |
Re: I can't think of anything. If it is in the same directory, then that line should work. Check your spelling of the module name? Sometimes it is something simple. | |
Re: Change to [icode]return n * self.calculate(n - 1)[/icode] | |
Re: I'm very glad that you like Python. When you get more and more experienced in Python, it will get easier to translate your thought process into code. So, when I think of a list of words that have individual values connected to them, then I usually think of Python's dictionaries. … | |
Re: Just as tonyjv suggested: [icode]str(bin(13))[2:].zfill(10)[/icode] | |
Re: Definitely Jython. It's Python that is implemented on the Java platform. Look into it at [URL="http://www.jython.org/"]http://www.jython.org/[/URL]. | |
Re: [icode]while True[/icode], or any indefinite loop is integral to Python. All programs written in Python should have at least one of them. | |
Re: Works correctly. Order of operations. This also works: [CODE](-1+0j)**.5[/CODE] without error. | |
Re: Python for .Net is good, but [URL="ironpython.net"]IronPython[/URL] is better. It's Python written in C#, and you can use it with Visual Studio 2010. Check out the main website. Main use of Python? It's easy and powerful. You can embed it in your C# application if you want. You can also … | |
| |
Re: Embedded in your C# windows application? That sounds like IronPython. You can add a reference to IronPython and Microsoft.Scripting.Hosting assemblies to embed a Python application inside your C# one. | |
Re: Why do you have so many global statements? Or did glade do that? You should have self.r, self.a1, etc instead of them all being global. Global is bad. | |
Re: I repro-d your error with this: [CODE]"".replace(0.02,0)[/CODE] What exactly are you trying to do? | |
Re: What you seem to be trying to do is multiply a list by another list. What do you expect the results to be? | |
Re: Either externally in a configuration file or database, or in the registry for Windows. There is no other way. EDIT: or environment variables | |
Re: Well, you won't get an experience like those C# reporters, I think, because there really isn't a Visual Studio for Python. You can take a look at this SO question: [URL="http://stackoverflow.com/questions/177799/what-is-a-good-pdf-report-generator-tool-for-python"]http://stackoverflow.com/questions/177799/what-is-a-good-pdf-report-generator-tool-for-python[/URL] | |
Re: Always use os.path.join! It's much easier and there's less room for error. [icode]workPath = os.path.join('Prod','Projects',project,'shots',path,'render','REN')[/icode] |
The End.