LoginSignup
1
1

More than 5 years have passed since last update.

Python > f.dtype > S7 > リスト内のstringsの長さの最大が7

Last updated at Posted at 2018-04-11

@ Scipy lecture notes, Edition 2017.1
https://www.scipy-lectures.org/_downloads/ScipyLectures-simple.pdf
p52
https://www.scipy-lectures.org/intro/numpy/array_object.html#basic-data-types

dtype('S7')という結果となる例がある。

定義したリスト内のstringsの長さの最大が7であるということらしい。

import numpy as np

f = np.array(['Bonjour', 'Hello', 'Hallo', ])
print(f.dtype)

for elem in f:
    print(len(elem))
run
|S7
7
5
5

fの定義の最後の","は不要に思う。
https://github.com/scipy-lectures/scipy-lecture-notes/issues/371
(こういう報告はした方がいいかどうかは悩むところ)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1