[Tutor] Opening files?

Rob Andrews rob@jam.rr.com
Wed Mar 26 13:00:04 2003


Just at a glance, I'd say you left the / off after the C: in your opening
statement. And I believe that last bit is the address of the myTest object.

-Rob

--
Mississippi Hermetic Connection:
http://uselesspython.com/hermetica/hermetica.html

> -----Original Message-----
> Ok...I wrote and ran this:
>
> >>> myTest = open("C:test.txt", 'r')
> >>> for eachLine in myTest:
> ... 	print eachLine
> ...
> >>> myTest.close()
> >>>
>
> No syntax errors...yay! But this was all I got:
>
> >>>
>
>
> A carriage return and a prompt... how do I get the text in my
> file "test.txt" to print?
>
> Futhermore, if I do the following:
>
> >>> myTest = open("C:test.txt", 'r')
> >>> print myTest
>
> I get this:
>
> <open file 'C:test.txt', mode 'r' at 0x0090CE18>
> >>>
>
> What is the last bit? An address of sorts?
>
> -Jeff