Copy text from text file into another text file - Method 1

#!/usr/bin/env python3 ''' lines.txt just a simple text file ''' def main(): file_in = open('lines.txt','rt') file_out = open('lines-copy-1.txt','wt') for line in file_in: print(line.rstrip(), file=file_out) print('.', end='', flush=True) file_in.close() file_out.close() print('\nDone.') if __name__ == '__main__': main()
Copy text from text file into another text file - Method 1

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.