Skip to main content
## Basic Usage

import drill
doc = drill.parse(path_or_url_or_string)

# Drill down to a specific element.
print unicode(doc.book.title)

# Iterate through all "title" tags in the document.
for t in doc.iter('title'):
print t.attrs, t.data

# Find all "bar" nodes with a "baz" child and a "foo" parent.
q = doc.find('//foo/bar[baz]')
# Easily access the first and last elements of matching results.
print q.first(), q.last()
# Iterate over results.
for e in q:
do_something(e)

# Parse only elements matching some path
for e in drill.iterparse(filelike, xpath='root/*/something'):
print e.tagname, e.data

## Features

* Runnable test suite
* Python 3 support

## Advantages

* Pure python
* Faster, more efficient parsing than ElementTree
* Using ElementTree, a ~150 MB XML file (~3,000,000 elements) took ~46 seconds to parse, consuming ~1.3 GB of RAM
* Parsing the same file using drill took ~24 seconds and consumed ~950 MB of RAM
* Very unscientific benchmarks performed on a Core i5 @ 2.8 GHz, running Windows 7. YMMV.
* Lots of convenience methods for accessing elements quickly:
* doc.response.resultCode.data
* root[2].child['attr']
* first/last/prev/next methods for traversing siblings


Metadata

Release files for drill 1.2.0

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

Source distribution (sdist)

Source distribution for drill 1.2.0
File Size Uploaded
drill-1.2.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drill 1.2.0
File Interpreter ABI Platform
drill-1.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.0 kB

Release files / drill-1.2.0.tar.gz

Download URL drill-1.2.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d2645ed6d3cfc925bd7bf5328982d8a5aff7cda9c7e56107c7a74482f7037b7d
BLAKE2b-256 checksum
How to use checksums
e4213d1dec8958c74c3d1f46a6f264e12b146a4b97458240a68ad10ab3a41031
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release files / drill-1.2.0-py2.py3-none-any.whl

Download URL drill-1.2.0-py2.py3-none-any.whl
Size 8.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
fb5a1eae68993076d033034dd446a832f2b9757222478c47f0cf129bafe70a74
BLAKE2b-256 checksum
How to use checksums
736c2871f4b4ad4dbc2d0fc7078e1b91fbdd2a62b33b9ffe9cba3dc610fd669b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

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