Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.base_repr

numpy.base_repr(number,base=2,padding=0)[source]

Return a string representation of a number in the given base system.

Parameters:
number:int

The value to convert. Positive and negative values are handled.

base:int, optional

Convertnumber to thebase number system. The valid range is 2-36,the default value is 2.

padding:int, optional

Number of zeros padded on the left. Default is 0 (no padding).

Returns:
out:str

String representation ofnumber inbase system.

See also

binary_repr
Faster version ofbase_repr for base 2.

Examples

>>>np.base_repr(5)'101'>>>np.base_repr(6,5)'11'>>>np.base_repr(7,base=5,padding=3)'00012'
>>>np.base_repr(10,base=16)'A'>>>np.base_repr(32,base=16)'20'

Previous topic

numpy.printoptions

Next topic

numpy.DataSource

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp