Schedule

Schedule

Friday, August 22

1408726800 Tech News Today
1408730400 This Week in Law
1408737600 Android App Arena
1408748400 Tech News 2Night

Saturday, August 23

1408816800 The Tech Guy

Sunday, August 24

1408903200 The Tech Guy
1408917600 This Week in Tech

Monday, August 25

1408986000 Tech News Today
1408989600 Triangulation
1408995000 iPad Today
1409007600 Tech News 2Night
1409009400 Marketing Mavericks

Tuesday, August 26

1409072400 Tech News Today
1409076000 MacBreak Weekly
1409083200 Security Now
1409090400 Before You Buy
1409094000 Tech News 2Night
1409097600 All About Android
1409106600 Padre's Corner

Wednesday, August 27

1409153400 FLOSS Weekly
1409158800 Tech News Today
1409162400 Windows Weekly
1409169600 This Week in Google
1409180400 Tech News 2Night
1409182200 redditUP
1409187600 Ham Nation

Thursday, August 28

1409245200 Tech News Today
1409248800 Know How...
1409252400 The Social Hour
1409257800 Coding 101
1409261400 Home Theater Geeks
1409266800 Tech News 2Night
1409268600 The Giz Wiz
1409277600 OMGcraft

Friday, August 29

1409331600 Tech News Today
1409335200 This Week in Law
1409342400 Android App Arena
1409353200 Tech News 2Night

Saturday, August 30

1409421600 The Tech Guy

Sunday, August 31

1409508000 The Tech Guy
1409522400 This Week in Tech

Most Recent Episodes

The Giz Wiz
Episode #1482: Nailed It! August 21st, 2014

Magnetic Nail Setter.

Coding 101

The return of C#

Tech News 2Night

Instagram adds analytics.

iFive for the iPhone

N3TWORK, Battery Doctor

Know How...

How to download YouTube videos

The Social Hour

Facebook's new satire labels, how to .gif YouTube vids, Kuddle for kids

OMGcraft

Minecraft puzzle game.

Tech News Today

Hewlett-Packard yesterday surprised Wall Street by posting an unexpected increase in revenue.

Ham Nation

Bob Heil shows how to build an audio impedance matching box.

redditUP

IE dev team AMA, birdmen vs mudmen.

Coding 101 16

Python - The External Data Circle of Life

May 8 2014

Hosts: Fr. Robert Ballecer, SJ and Shannon Morse

Guest: Dale Chase

Welcome to Coding 101 - It's the TWiT show that gives YOU the knowledge to live in the wonderful world of the programmer. This week we are introducing our newest module, Python with Code Warrior Dale Chase!

To see all the code used in today's episode, go to Our Github Repository for Module 2

Ivory Tower: External File IO

Using external data reqires knowledge of four functions: "open()", "
read()", "write()" and "close()"

open()
This function opens a file with the flags and mode of your choosing. For simplicity, we're only using the "r" "w" modes.
-- The "r" mode opens a file for "read only" use
-- The "w" mode blanks the file prepares to write to the file
* Note that this function DOES NOT READ THE FILE INTO A VARIABLE.

USAGE:
text_file = open("/Users/PadreSJ/Desktop/C101-16/write.txt", "r")
# This opens a file called "write.txt" in READ-ONLY mode and sets the pointer in variable "text_file"

text_file = open("/Users/PadreSJ/Desktop/C101-16/write.txt", "w")
# This opens a file called "write.txt" in WRITE MODE, sets the pointer in variable "text_file" and blanks that file.

read()
This function reads the contents of the file into a string variable.

USAGE:
textFromFile = text_file.read()
#This reads the file at pointer "text_file" into the string variable "textFromFile"

write()
This function writes a string into an external file.

USAGE:
text_file.write(MyString)
#This writes the contents of the string variable "MyString" into the file indexed at "text_file"

close()
This function closes access to the file.

USAGE:
text_file.close()

#This closes the file indexed at "text_file"

Get in Touch With Us!

* Subscribe and get Coding 101 automatically at TWiT.tv!
* Follow PadreSJ and Snubs on Twitter.
* Watch the show live and join the chatroom every Thursday at 1:30pm PST.
* Email us at Padre@twit.tv and Shannon@twit.tv.
* Join our Google+ Community!

Download or subscribe to this show at twit.tv/code. Also, check out our transcripts.

Bandwidth for Coding 101 is provided by Cachefly.

Running time: 49:50