I Need A Placeholder

Ampedesign metalkeys404 at gmail.com
Thu Jun 26 13:07:36 EDT 2008


On Jun 26, 10:06 am, Daniel Mahoney <d... at catfolks.net> wrote:
> On Thu, 26 Jun 2008 10:03:47 -0700, Ampedesign wrote:
> > I'm trying to build a try/except case, and I want to have the except
> > function like such:
>
> > try:
> >       # Do some code here
> >       var = 1         # For example
> > except:
> >       #Do nothing here
>
> > The only problem is if I leave a comment only in the except block, I
> > get an error back saying that the except block is not properly
> > formatted, since it has no content other than a comment.
>
> > So if anyone could suggest some code to put there as a placeholder
> > that would be wonderful.
>
> "pass" would work fine.
>
> try:
>      # Do something that can throw an exception
> except:
>      pass

Thanks. That will work perfectly.



More information about the Python-list mailing list