Reputation: 41
I have a file text.txt that contains text data: this is a text file
then I have a test.text that is primarily empty.
from sys import argv
script, from_file, to_file = argv
out_file = open(to_file, 'w').write((open(from_file).read()))
when I run that code the test.txt file gets copied text from text.txt file and it is:
this is a text fileഀ
ഀ
why do I get those rectangular blocks?? How to fix it??
Upvotes: 0
Views: 282
Reputation: 55962
If you look closely at the "rectangular blocks" you can see that they contain the rows
0A
and
0D
which are the hex representations of '\n'
and '\r'
respectively. So the blocks are your editor's way of showing you these characters, which are used in Windows to mark the end of a line in a text file and which are usually invisible.
Upvotes: 1