Frequently asked questions

Syntax, keywords and built-in functions

Standard distribution

import implementation

Brython packages

Browser interface

Brython-specific built-in modules

Working with Brython



Query string

browser.document supports the attribute query, that returns the query string as an object with the following attributes and methods :

  • document.query[key] : returns the value associated with key. If a key has more than one value (which might be the case for SELECT tags with the attribute MULTIPLE set, or for <INPUT type="checkbox"> tags), returns a list of the values. Raises KeyError if there is no value for the key

  • document.query.getfirst(key[,default]) : returns the first value for key. If no value is associated with the key, returns default if provided, else returns None

  • document.query.getlist(key) : returns the list of values associated with key (the empty list if there is no value for the key)

  • document.query.getvalue(key[,default]) : same as document.query[key], but returns default or None if there is no value for the key