Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: You gotta love a 2-line python solution Date: Mon, 2 May 2016 02:46:27 -0400 Lines: 19 Message-ID: References: <1462163501.1158885.595255233.34023BE4@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de X3OVBWJJA9igWDmgHqp5twttONfvYWFkgdcFqAnDXp6g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'paths': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'jan': 0.11; 'subject:python': 0.14; 'dfs': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'slashes': 0.16; 'urllib': 0.16; 'wrote:': 0.16; 'windows': 0.20; 'issue.': 0.20; 'file:': 0.22; 'stephen': 0.22; 'am,': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:u 20': 0.28; 'anywhere': 0.30; 'skip:- 30': 0.32; 'skip:/ 20': 0.33; 'windows.': 0.33; 'file': 0.34; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'names': 0.38; 'does': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'save': 0.60; 'avoid': 0.61; 'received:96': 0.63; 'webpage': 0.66; 'forward': 0.66; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: <1462163501.1158885.595255233.34023BE4@webmail.messagingengine.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <1462163501.1158885.595255233.34023BE4@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:107995 On 5/2/2016 12:31 AM, Stephen Hansen wrote: > On Sun, May 1, 2016, at 08:39 PM, DFS wrote: >> To save a webpage to a file: >> ------------------------------------- >> 1. import urllib >> 2. urllib.urlretrieve("http://econpy.pythonanywhere.com >> /ex/001.html","D:\file.html") >> ------------------------------------- > > Note, for paths on windows you really want to use a rawstring. Ie, > r"D:\file.html". Or use forward slashes "D:/file.html" and avoid the issue. I don't know of anywhere this does not work for file names sent from python directly to Windows. -- Terry Jan Reedy