I can't remember if attachments are permitted on this list or not, so I apologize in advance. I've been looking at functions and stuff in the python tutorials and although I copied them character for character, as far as I know, I get an error saying that there is an unexpected indentation. Would anyone be able to let me know if you find any problems with the indentation? Thanks, Harmony.
def print_two(*args): arg1, arg2 = args print "arg1: %r, arg2: %r" % (arg1, arg2) def print_two_again(arg1, arg2): print "arg1: %r, arg2: %r" % (arg1, arg2) def print_one_arg(arg1): print "arg1: %r" % arg1 def print_none() print "I got nothing." print_two("Harmony","Neil") print_two_again("Harmony","Neil") print_one_arg("Louise") print_none()
from sys import argv script, filename = argv print "We're now going to erase %r." % filename print "if you don't want to do this, hit CTRL-C (^C)." print "If you do want this, hit RETURN." raw_input("?") print "Opening file..." target = open(filename, 'w') print "Truncating the file. Goodbye!" target.truncate() print "Now I will ask you for three lines." line1 = raw_input("line 1: ") line2 = raw_input("line 2: ") line3 = raw_input("line 3: ") print "I am going to write these to the file.") target.write(line1) target.write("\n") target.write(line2) target.write("\n") target.write(line3) target.write("line3") print "And finally, we close it." target.close()