Skip to main content
https://travis-ci.org/necrolyte2/filehandle.svg https://coveralls.io/repos/necrolyte2/filehandle/badge.svg https://badge.fury.io/py/filehandle.svg

filehandle

Normalize the way you get file handle from either gzip or normal file

Typical way to open gzip or regular file

>>> import gzip
>>> import os.path
>>> files = ['/path/to/foo.bar.gz', '/path/to/foo.bar']
>>> for f in files:
...   root, ext = os.path.splitext(f.replace('.gz',''))
...   ext = ext[1:]
...   if f.endswith('.gz'):
...     handle = gzip.open(f)
...   else:
...     handle = open(f)

Using filehandle

>>> import filehandle
>>> files = ['/path/to/foo.bar.gz', '/path/to/foo.bar']
>>> for f in files:
...   handle, extension = filehandle.open(f)

Release files for filehandle 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filehandle 0.0.9
File Size Uploaded
filehandle-0.0.9.tar.gz 1.6 kB Details

Release files / filehandle-0.0.9.tar.gz

Download URL filehandle-0.0.9.tar.gz
Size 1.6 kB
Tags Source
SHA-256 checksum
How to use checksums
99c966fe0c4df486759799264b2a4c0b84763f1674dec6c5e6d8a3e11f004077
BLAKE2b-256 checksum
How to use checksums
54ec1a6385184b6fc512b62ace58cc4446bdc1b5a693f93157edd030ad3125b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.9 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page