Skip to main content
added 1 characters in body
Source Link
Nathan Villaescusa
  • 17.5k
  • 4
  • 54
  • 58

You can use the with statement to open the file, which will ensure that the file is closed.

with open('/some/file', 'rb') as f:
    parser = ParserClasss(f)
    return list(parser.info())

See http://www.python.org/dev/peps/pep-0343/ for more details.

You can use the with statement to open the file which will ensure that the file is closed.

with open('/some/file', 'rb') as f:
    parser = ParserClasss(f)
    return list(parser.info())

See http://www.python.org/dev/peps/pep-0343/ for more details.

You can use the with statement to open the file, which will ensure that the file is closed.

with open('/some/file', 'rb') as f:
    parser = ParserClasss(f)
    return list(parser.info())

See http://www.python.org/dev/peps/pep-0343/ for more details.

Source Link
Nathan Villaescusa
  • 17.5k
  • 4
  • 54
  • 58

You can use the with statement to open the file which will ensure that the file is closed.

with open('/some/file', 'rb') as f:
    parser = ParserClasss(f)
    return list(parser.info())

See http://www.python.org/dev/peps/pep-0343/ for more details.