2018-05-17

posted May 17, 2018, 6:04 AM by Konstantinovich Samuel   [ updated May 18, 2018, 9:31 AM ]
Lab + Homework: 
(At this point this is a solo assignment. Take the code you wrote with your partner, and add to it!)

Complete the Book analysis lab and make a website 
~/public_html/05/wordcount.py  (the website should work and print out like mine)

1. Title of the book

2. General Stats
x characters in the text file.
x words in the book. (total, not unique)
? unique words in the book. (all words converted to lower case)
? words that are used over 250 times (repeated words)
? words that are used once (unique words)
? words that are over 15 letters long (long words)

3. A list of long words: (length greater than 15)
[' MAKE A LIST OF THEM AND PRINT HERE']

4. The 250 most common words in the book: (in a table)
ID Word count
0 the 401 (this isnttherightnumber)
1   a 340
...
...




5. 
HELP WITH ERRORS:

1. First 4 lines:
#!/usr/bin/python
print "Content-type: text/html\n"
import cgitb
cgitb.enable()

2. Executeable.
In the lab: 
  Right click the file and click properties -> permissions
  Check the "executeable" checkbox to allow it to be run.
At home: 
  In filezilla/winscp, right click the REMOTE file (right side of screen)
  Check off the "X" checkboxes to make it executeable

3. Windows Line endings. 
At home or at school:
   Open the file using gedit. 
   On the Gedit menu bar (top of window, or top of screen) Click file->save as        
   Make sure the line endings is set to "unix/linux", NOT "windows"
   (If you are home, upload AFTER doing this)
ALTERNATE SOLUTION on windows at home:
   When uploading using winscp select "text" as your transfer mode (instead of default)

Comments