Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Learn Python the Hard Way exercise 15

Name: Anonymous 2012-02-22 19:59

Hey there, absolute non-programmer here trying to do the first steps.

I'm kinda "stuck" on Exercise 15s Extra Credits.

Basically, I'd like to ask you guys how I'd close() the files I've opened in this script and would love if you could look at the comments I made above each line to check if they're somewhat correct.

http://pastebin.com/uwyh1A4C

Name: Anonymous 2012-02-22 20:02

By hitting her over the head. That way she won't put up a fight when you attempt to close her legs.

Name: Anonymous 2012-02-22 20:03

Read SICP.

Name: Anonymous 2012-02-22 20:06

>>3
1/10

Name: Anonymous 2012-02-22 20:15

txt.close()

This is really something you could google.

Name: Anonymous 2012-02-22 20:19

>>5
Shucks, of course!
Makes sense.

Thank you! If you'd take a look at the comments and perhaps tell me if I got something wrong, I'd greatly appreciate it.

Name: Anonymous 2012-02-22 21:18

>>6
Take your shitty book and fuck off back to /g/. Come back when you've read SICP.

Name: Anonymous 2012-02-22 22:00

>>7
Take your shitty book and fuck off back to the 3rd stall. Come back when you've scrubbed the remaining toilets.

Name: Anonymous 2012-02-22 22:04

>>8
Hey buster....It's Monday. I ain't gotta do shit.

Name: Anonymous 2012-02-23 2:15

>>9
Only the master race may have a non-work day, and that is Shabbos.  Now fuck off back to work you dumb goy before I have you whipped again!

Name: Anonymous 2012-02-23 3:10

>>10
it isn't funny. it's not even not funny. it's just dumb.

Name: Anonymous 2012-02-23 3:42

# get the "Argument Variable" from module "sys"
from sys import argv

# "unpacks" argv, calls 1 variable
script, filename = argv

# The variable txt is assigned to open our specified filename
txt = open(filename)

# Text is printed using the variable filename from before
print "Here's your file %r" % filename
# the variable txt is ".read" without parameters
print txt.read()


print "Type the filename again:"
# The raw input by the user is assigned to the variable file_again
file_again = raw_input("> ")

# the filename from before is opened and is no in the variable txt_again
txt_again = open(file_again)

# txt_again is .read without any parameters
print txt_again.read()


This code must be preserved for ichi-kun's eternal shame

Name: Anonymous 2012-02-23 10:02

Learn D

Name: Anonymous 2012-02-23 11:43

Read LPTHW
Write your first program
FUCKING
COMMENTS
EVERYWHERE


Zed Shaw taught you well how to be a complete fucking douche.

Don't change these.
Name: Email:
Entire Thread Thread List