This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / lib / _iotools / str2bool

function

numpy.lib._iotools:str2bool

source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_iotools.py :386

Signature

def   str2bool ( value )

Summary

Tries to transform a string supposed to represent a boolean to a boolean.

Parameters

value : str

The string that is transformed to a boolean.

Returns

boolval : bool

The boolean representation of value.

Raises

: ValueError

If the string is not 'True' or 'False' (case independent)

Examples

import numpy as np
np.lib._iotools.str2bool('TRUE')
np.lib._iotools.str2bool('false')

Aliases

  • numpy.lib._iotools.str2bool