Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python数据类型:什么是'|S.';什么意思?_Python_Numpy - Fatal编程技术网

Python数据类型:什么是'|S.';什么意思?

Python数据类型:什么是'|S.';什么意思?,python,numpy,Python,Numpy,noob问题,但在这个小数组中: array(['22', '38', '26', '35', '35', '', '54', '2', '27', '14', '4', '58', '20', '39', '14'], dtype='|S82') “| S82”是什么意思 它定义了数据类型的字节顺序、种类和大小。在这种情况下: byte-order: | not applicable kind: S (byte-)string size: 82 (ch

noob问题,但在这个小数组中:

array(['22', '38', '26', '35', '35', '', '54', '2', '27', '14', '4', '58',    '20', '39', '14'], dtype='|S82')
“| S82”是什么意思

它定义了数据类型的字节顺序、种类和大小。在这种情况下:

byte-order: |   not applicable
kind:       S   (byte-)string
size:       82  (characters long)
尝试:

此外,不能有更长的字符串。

数据类型的第一个字母告诉您它是什么类型的数据

Array-protocol type strings (see The Array Interface) 

The first character specifies the kind of data and the remaining characters
specify the number of bytes per item, except for Unicode, where it is     
interpreted as the number of characters. The item size must correspond to an    
existing type, or an error will be raised. The supported kinds are  
  'b'       boolean  
  'i'       (signed) integer   
  'u'       unsigned integer  
  'f'       floating-point  
  'c'       complex-floating point  
  'O'       (Python) objects  
  'S', 'a'  (byte-)string  
  'U'       Unicode  
  'V'       raw data (void)  
因此,在您的示例中,指定它是一个82个字符长的字节字符串

In [295]: a[1]='seventeen';a
Out[295]: array(['one', 'seven', 'three'], dtype='<S5')
Array-protocol type strings (see The Array Interface) 

The first character specifies the kind of data and the remaining characters
specify the number of bytes per item, except for Unicode, where it is     
interpreted as the number of characters. The item size must correspond to an    
existing type, or an error will be raised. The supported kinds are  
  'b'       boolean  
  'i'       (signed) integer   
  'u'       unsigned integer  
  'f'       floating-point  
  'c'       complex-floating point  
  'O'       (Python) objects  
  'S', 'a'  (byte-)string  
  'U'       Unicode  
  'V'       raw data (void)