## 6.2.2 Converting strings to numbers

Strings which contain numerical data can be converted to numbers by passing them to the object `types.number()`, as in the examples:

`pyxplot> print types.number("23")`
`23`
`pyxplot> print types.number("1610 1643 1715 1774".split()[2])`
`1715`
`pyxplot> print types.number("978-0230200951"[4:])`
`230200951`

It is an error to try to convert a string to a number if it does not contain a correctly-formatted number:

| `types.number("this is not a number")`