hi created a simple python program that reads the source code of a url and stores into a variable then saves the sourcecode into a file on the computer but the problem that i have that is when python reads the sourcecode it stores it all in one line in a variable is there a way to keep formatting of the source code as it suppose to be ??

Recommended Answers

There are problems sometimes with the interpretation of end of line characters, depending on your platform and the program which opens your file. If your output file was written using opening mode 'wb', try mode 'w', it may solve the issue.

Jump to Post

All 2 Replies

There are problems sometimes with the interpretation of end of line characters, depending on your platform and the program which opens your file. If your output file was written using opening mode 'wb', try mode 'w', it may solve the issue.

i used mode "w" it gave me it in one line used "wb" gave it me in a block

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.