日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python numpy np.fromstring()函数(从字符串文本中提取数字,返回一维数组)(爬虫提取数字挺好用的)

發布時間:2025/3/20 python 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python numpy np.fromstring()函数(从字符串文本中提取数字,返回一维数组)(爬虫提取数字挺好用的) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

from numpy\core\multiarray.py

def fromstring(string, dtype=None, count=-1, sep=''): # real signature unknown; restored from __doc__"""fromstring(string, dtype=float, count=-1, sep='')A new 1-D array initialized from text data in a string.從字符串中的文本數據初始化的新一維數組。Parameters----------string : strA string containing the data.包含數據的字符串。dtype : data-type, optionalThe data type of the array; default: float. For binary input data,the data must be in exactly this format.數組的數據類型; 默認值:浮動。 對于二進制輸入數據,數據必須完全采用這種格式。 count:int,可選count : int, optionalRead this number of `dtype` elements from the data. If this isnegative (the default), the count will be determined from thelength of the data.從數據中讀取此數量的dtype元素。 如果為負(默認值),則將根據數據長度確定計數。sep : str, optionalThe string separating numbers in the data; extra whitespace betweenelements is also ignored.字符串,分隔數據中的數字; 元素之間的多余空格也將被忽略。.. deprecated:: 1.14If this argument is not provided, `fromstring` falls back on thebehaviour of `frombuffer` after encoding unicode string inputs aseither utf-8 (python 3), or the default encoding (python 2).如果未提供此參數,則在將Unicode字符串輸入編碼為utf-8(python 3)或默認編碼(python 2)后,fromfromstring會退回到frombuffer的行為。Returns-------arr : ndarrayThe constructed array.構造的數組。Raises------ValueErrorIf the string is not the correct size to satisfy the requested`dtype` and `count`.如果字符串的大小不正確,不能滿足要求的`dtype`和`count`。See Also--------frombuffer, fromfile, fromiterExamples-------->>> np.fromstring('1 2', dtype=int, sep=' ')array([1, 2])>>> np.fromstring('1, 2', dtype=int, sep=',')array([1, 2])"""pass

示例

總結

以上是生活随笔為你收集整理的python numpy np.fromstring()函数(从字符串文本中提取数字,返回一维数组)(爬虫提取数字挺好用的)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。