Alan G wrote: "This is a bad idea. Instead, write your strings directly to o
o.write(s)
Print adds newlines automatically(unless you explicitly suppress
them). But printing to a file is messy compared to writing directly to
the file. (And also means you cant print debug messages while
developing
Matt Varner wrote:
> This result works perfectly (REMs removed):
>
> f = open('tmp.txt', 'r')
> o = open('result.txt', 'w')
> lns = f.readlines()
> f.close()
> for line in lns:
> if ".\n" in line:
> a = line.replace('.\n','. ')
> o.write(a)
> else:
> a = line.stri
To prove that a little knowledge is a little stupid or something to that
effect:
#for key in key_list:
#print(key)
#if key not in key_list0:
#print("Error:", key, "not available, start again")
#get_new_list = True
#break
#else: get_