[sudo-discuss] Session 1 - Python learning + data on domestic violence
Romy Ilano
romy at snowyla.com
Mon Feb 22 17:29:36 PST 2016
Session 1 went well today! Hope to see you at the next session.
Super simple "no deep stuff" ;)
*Session 1 done today!*
https://github.com/romyilano/SudoRoom_Python_DomesticViolence#session-1---intro
Session 1 - Preparations
- Get set up on your computer - Railsbridge is excellent, great people,
great installation advice (Railsbridge Installation Guide)[
http://docs.railsbridge.org/installfest/choose_your_operating_system]
- Be comfortable with the command line - Learn Command line the hard way
<http://cli.learncodethehardway.org/book/> *IMHO the more comfortable
you get with the command line the better off you'll be in the short and
long run*
- Understand how to use git
- Complete Learn Python the Hard Way
<http://learnpythonthehardway.org/book/> up until Lesson 20
<http://learnpythonthehardway.org/book/ex20.html> -
<https://github.com/romyilano/SudoRoom_Python_DomesticViolence#session-1---the-doing-part>Session
1 - the Doing part
Open up the terminal on your computer.
- *Don't know the terminal and command line? Go here
<http://cli.learncodethehardway.org/book/>*
mkdir SudoLesson
cd SudoLesson
Now use git to clone the github repo
<https://github.com/romyilano/SudoRoom_Python_DomesticViolence> for this
workshop
git clone https://github.com/romyilano/SudoRoom_Python_DomesticViolence
- *Don't know how to use git from the command line?* review cloning and
the basics the simple guide <http://rogerdudler.github.io/git-guide/>
cd SudoRoom_Python_DomesticViolence
write your first script in the python folder, name it intro_python.py
from sys import argv
script, filename = argv
in_file = open(filename)
indata = in_file.read()
print("Here's your file %r:" % filename)
print("The sample csv is %d bytes long" % len(indata))
input(" Return to continue >")
print("Now I'm going to print out all the data - it's very long!")
input(" Return to continue >")
print(indata)
input(" Return to continue >")
print("Closing the file")
in_file.close()
Run the script, we'll be using the sample.csv which is the spreadsheet of
crimes in the Oakland area in the past 90 days
python python/intro_python.py csv/sample.csv
Self-directed Learning Steps
- Make 2 or 3 variations of this script
- Redo the Learn to Code the hard way lessons
- Download other csv files and read them
-
=============================
Romy Ilano
romy at snowyla.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sudoroom.org/pipermail/sudo-discuss/attachments/20160222/1f01c927/attachment.html>
More information about the sudo-discuss
mailing list