Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~34.2K People Reached
Favorite Forums
Member Avatar for vegaseat

The example shows how to establish a dictionary of (row, column):value pairs to mimic a two dimensional array. This can be easily expanded to more dimensions. Python3 has dictionary comprehension, making the process of creating a dictionary of this type easier.

Member Avatar for vegaseat
1
7K
Member Avatar for vegaseat

This snippets shows how to have fun replacing multiple words in a text. The target words and the replacement words form key:value pairs in a dictionary. The search and replacement is done using Python's regular expression module re. The code also gives an example of a function within a function.

Member Avatar for Gribouillis
0
20K
Member Avatar for vegaseat

This Python code allows you to get selected statistics of a story text. It will count lines, sentences, words, list words and characters by frequency, and give the average word length. It should be easy to add more statistics using the dictionaries created.

Member Avatar for Ene Uran
3
798
Member Avatar for Skrell

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 …

Member Avatar for Skrell
0
286
Member Avatar for Skrell

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 …

Member Avatar for Skrell
0
97
Member Avatar for vegaseat

Early versions of Python used a hybrid of samplesort (a variant of quicksort with large sample size) and binary insertion sort as the built-in sorting algorithm. This proved to be somewhat unstable, and was replaced in version 2.3 with an adaptive mergesort algorithm. I am comparing several rudimentary sorting routines, …

Member Avatar for Skrell
1
4K
Member Avatar for Skrell

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 …

Member Avatar for Skrell
0
103
Member Avatar for TrustyTony

Learned about hook functions [URL="http://www.daniweb.com/software-development/python/threads/383164/1650339#post1650339"]for a thread[/URL] having problem with bad user input from the documentation. This is result which skips bad inputs.

Member Avatar for TrustyTony
0
943
Member Avatar for Skrell

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]

Member Avatar for JoshuaBurleson
0
110
Member Avatar for Skrell

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 …

Member Avatar for TrustyTony
0
495
Member Avatar for Skrell

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 …

Member Avatar for TrustyTony
0
202
Member Avatar for Skrell

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 >>>

Member Avatar for Gribouillis
0
99
Member Avatar for Skrell

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 …

Member Avatar for markfw
0
223