I'm just starting out with Python but I'm stuck already and can't proceed unless I understand how this works. I'm trying to append the contents of two files to a new file. Each of the two source files has only a few simple lines of text (words separated by spaces) with Unix line returns, but no commas or other delimiters (I will try to work with more complex files later).
I understand that these strings are read in as lists but cannot find a way to print lists that are read from a file. I tried using "for line in src1:" followed by a print statement but got a syntax error. My most recent attempt at a script is attached below. The errors are:
File "./test.py", line 11, in ?
TypeError: an integer is required
File "./test.py", line 12, in ?
TypeError: argument 1 must be string or read-only character buffer, not list
I don't think I should need to define a method unless I'm trying to strip quotation marks, line returns or white spaces. Let me know what I'm missing, thanks
import string, sys, fileinput
output1 = src1.readlines()
output2 = src2.readlines()
dest = open( 'my_dest.txt', 'a' )