No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
13 Posted Topics
Re: First of all i LOVE these code snippets you did for various Python topics, i find them EXTREMELY helpful. With that said, i'm wondering what does the term "hash order" mean? I've seen the word "hashable" used several times now with Python and do not understand what it is referring … | |
Re: i have spent the last hour trying to figure out this section of code from above. [CODE]def translate(match): return wordDic[match.group(0)][/CODE] Can anyone PLEASE explain what this is doing and how it works? | |
Re: Can someone please explain to me the difference between these 2 lines: [CODE]if lastchar in punctuations:[/CODE] and [CODE] if key in '.!?':[/CODE] Why in one case can we check against a list of string values and in the other case against a string ? | |
I recently came across this code on the internet and I'm having a very hard time understand how it works. I was hoping someone could comment the code a bit in order to help me learn it better? I understand most of it, but get lost when any of the … | |
First, i'm new to C and trying to teach it to myself so be gentle. All i'm trying to do is malloc a block of memory so that i can store a few strings. These strings are to be pointed at by an array of pointers so that as i … | |
Re: Would someone mind explaining the code: [CODE]def print_timing(func): def wrapper(*arg): t1 = time.clock() res = func(*arg) t2 = time.clock() print '%s took %0.3fms' % (func.func_name, (t2-t1)*1000.0) return res return wrapper[/CODE] as i don't understand how "res" works or what func is doing ? | |
After MANY hours searching online documentation, i still cannot find some simple examples of using the subprocess module to execute commands in the windows console and read back in the output from said command(everything is for unix). So for example, if i wanted to do something like use 7z.exe to … | |
Re: Ok now that i've found your code, as I am a newb, would you mind explaining the openhook concept a bit as i don't full grasp it? | |
Why does this return None? [CODE]list1 = ['Herring','used','to','be','abundant','in','the','AtlAntic','Ocean','then','herring','got','overfished'] print list1.sort(key=lambda s : s.count('a'))[/CODE] | |
I am trying to use the fileinput.input() module to read in the lines from a bunch of files in a directory and occasionally receive an IOerror exception. What is the best way to handle this exception so that if 1 of the items in the list i'm feeding fileinput,input() generates … | |
Newbie here! I am trying to make a simple python program that when called from the command line, would search all the .txt files in a given directory for a given string inside the files by typing something like this > python mygrep.py ":" "C:\" Also, i want to specifically … | |
Can someone please explain these results to me and why they are different: >>> 7339520/(1024.0*1024) 6.99951171875 >>> print "%0.3f" % (7339520/(1024.0*1024)) 7.000 >>> | |
I can't seem to find this answer anywhere. All i want to do is write a list of numbers to a file using the file.write() method however i wanted to format the numbers as if i had been using a print statement. When you print you can use %0.2f for … |
The End.