from sys import argv
script , myfile=argv[0],argv[1]
print "here bro : %r" %(rfile)
rfile=open(myfile)
print rfile.read()
print "*" * 5
print "type ur file again"
another=raw_input("^_^ ")
mfile=open(another)
print mfile.read()
What's the problem here !?
i shouldn't see this line !!!
<open file 'Never give up .txt ,mode 'r' at 0x00485230> i think not problem but why i saw this line !!!
in
Exercise 15: Reading Files
he didn't get this line !!
If you wan't to wright something into the file use:
Myfile = open('Name of file',w)
Myfile.write( 'Text')
Myfile.close()
If you want to read something use this:
Myfile = open('Name of file',r)
OutText = Myfile.readline()
Myfile.close()
print(OutText )
I also think you have to import the pickel module
import pickle
It looks like you used: print(rfile)
That prints the object and it's place in the memory not the contents of the file.
edit: fixed code blocks
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement