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

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

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.