What's the problem here !?

Started by
11 comments, last by Scouting Ninja 9 years, 8 months ago

Here:


from sys import argv
script , myfile=argv[0],argv[1]
print "here bro" :                        #this is where you printed the memory
rfile=open(myfile)                      # rfile now = myfile open to reading
print rfile.read()                         # same as open(myfile).read()
print "*" * 5
print "type ur file again"
another=raw_input("^_^ ")         #another =  A raw input into the file
mfile=open(another)                 #mfile is new
print mfile.read()                       #this will now print the raw input
 
print rfile.read()                        #will print your old file again
I hope this helps, read the python manual it's well worded and easy to learn.
Advertisement

ty :)

but small & stupid question :D

#another = A raw input into the file

another = the file that i type !

or i just write in it !

so i must write mfile=open(another)rolleyes.gif

When using raw_input python will prompt you for the input.

All that raw_input does is convert the raw data text into a input()


TextHolder = input('->')
print(TextHolder)

It will now print:

-> Now you type your text

This will give you a error.

if you did this

-> "Now you type your text"

"Now you type your text" #it will print this


TextHolder = raw_input('->')
print(TextHolder)

It will now print:

-> Now you type your text

"Now you type your text"

if you did this

-> "Now you type your text"

""Now you type your text"" #it will print this with "Now you type your text" inside a string.

The code you are using allows you to change the name of the file with what you type in after "^_^"

edit:

You will need to use the new file name to read it now or a value linked directly to the file like "another".

mfile=open(another)

print(mfile) # to see what is inside

This topic is closed to new replies.

Advertisement