A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/085462.html below:

Resuming in exception handling

Resuming in exception handling Resuming in exception handlingAlex Martelli aleaxit at yahoo.com
Tue Apr 17 06:39:22 EDT 2001
"Lucas Vogel" <lucas7 at home.com> wrote in message
news:kwOC6.9726$181.2051642 at news1.rdc1.az.home.com...
    [snip]

General resumption is rather unfeasible, but your specific
case is not all that hard.  Moving the try/except within
the loop is the key to the solution here:


flist = glob.glob(LWPath + '\\LW*.txt')
for fname in flist:
    try:
        os.remove(fname)
    except OSError:
        print "skipping", fname
    else:
        print "removed", fname


Alex




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4