Schedule

Schedule

Sunday, January 25

1422212400 The Tech Guy
1422226800 This Week in Tech

Monday, January 26

1422295200 Tech News Today
1422298800 Triangulation
1422304200 iPad Today
1422316800 Tech News 2Night

Tuesday, January 27

1422381600 Tech News Today
1422385200 MacBreak Weekly
1422392400 Security Now
1422399600 Before You Buy
1422403200 Tech News 2Night
1422406800 All About Android
1422415800 Padre's Corner

Wednesday, January 28

1422462600 FLOSS Weekly
1422468000 Tech News Today
1422471600 Windows Weekly
1422478800 This Week in Google
1422489600 Tech News 2Night
1422491400 Android App Arena
1422496800 Ham Nation

Thursday, January 29

1422554400 Tech News Today
1422558000 Know How...
1422561600 Marketing Mavericks
1422567000 Coding 101
1422570600 Home Theater Geeks
1422576000 Tech News 2Night
1422577800 The Giz Wiz

Friday, January 30

1422640800 Tech News Today
1422644400 This Week in Law
1422662400 Tech News 2Night

Saturday, January 31

1422730800 The Tech Guy

Sunday, February 1

1422817200 The Tech Guy
1422831600 This Week in Tech

Monday, February 2

1422900000 Tech News Today
1422903600 Triangulation
1422909000 iPad Today
1422921600 Tech News 2Night

Tuesday, February 3

1422986400 Tech News Today
1422990000 MacBreak Weekly
1422997200 Security Now
1423004400 Before You Buy
1423008000 Tech News 2Night
1423011600 All About Android
1423020600 Padre's Corner

Most Recent Episodes

The Tech Guy
The Tech Guy 1155 January 24th, 2015

Is it safe to update Java on Windows XP?

Tech News 2Night
Episode #260: Box's Big IPO January 23rd, 2015

Skymall files for Bankruptcy

This Week in Law

Who should be responsible for determining international cyber law policies?

Tech News Today

Apple Watch battery and Winklevi the NASDAQ of Bitcoin.

This Week in Computer Hardware

GTX 960, Microsoft HaloLens, ECS LIVA X, and more!

Home Theater Geeks

More CES 2015 highlights.

The Giz Wiz

RX Robots, ChargerLeash, BluBed Holster, and more.

Coding 101
Episode #51: Steve Gibson January 22nd, 2015

Creator of SpinRite.

Tech News 2Night

iTunes Makes More Money Than Hollywood

Know How...

All of your quad copter questions.

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