How can I export data from a website and write the contents to a text file?

Rob Gaddi rgaddi at technologyhighland.invalid
Wed Nov 18 13:05:33 EST 2015


On Wed, 18 Nov 2015 09:40:58 -0800, ryguy7272 wrote:
> 
> It doesn't seem like the '\n' is doing anything useful.  All the text is
> jumbled together.  When I open the file in Excel, or Notepad++, it is
> easy to read.  However, when I open it in as a regular text file,
> everything is jumbled together.  Is there an easy way to fix this?

You're suffering cause-effect inversion.  Windows default Notepad is a 
fundamentally crippled text editor that only knows how to handle Windows/
DOS style text files, where the line endings is '\n\r'.  Notepad++, along 
with many other excellent editors available for Windows, is smart enough 
to figure out from the file whether it's Windows style or UNIX style, 
where line endings are just a bare '\n'.

So the problem wasn't with what you were writing, it's with how you 
define "open it as a regular text file".  On my Windows machine I long 
ago switched the default editor to Notepad++ for everything and was far 
happier for it.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list