0

Using the code from exercise 15 of Learn Python the Hard Way (by Zed Shaw), code of which is

from sys import argv

script, filename = argv

txt = open(filename)

print "Here's your file %r:" % filename

print txt.read()

print "Type the filename again:"

file_again = raw_input("> ")

txt_again  = open(file_again)

print txt.again.read()

I'm trying to run this using Powershell. I've been able to run every other exercise this way.

When I run python ex15.py ex15_sample.txt in Powershell, it doesn't prompt for user input like the previous few exercises, but instead just gives me a blank line.

1 Answer 1

1

This worked for me on OSX once I changed the last line to print txt_again.read(). If this doesn't work could you update your question with output from the console?

Sign up to request clarification or add additional context in comments.

2 Comments

Let me try this now. I'm using Win 7 Home Premium
yeah, that was it. Thank you so much! I need to get better at recognizing typos... I'll mark the answer as correct when it lets me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.