pipes — Shell 管道接口
pipes
sndhdr
源代码: Lib/sndhdr.py
Deprecated since version 3.11, will be removed in version 3.13: The sndhdr 模块被弃用 (见 PEP 594 for details and alternatives).
The sndhdr provides utility functions which attempt to determine the type of sound data which is in a file. When these functions are able to determine what type of sound data is stored in a file, they return a namedtuple() , containing five attributes: ( filetype , framerate , nchannels , nframes , sampwidth ). The value for type indicates the data type and will be one of the strings 'aifc' , 'aiff' , 'au' , 'hcom' , 'sndr' , 'sndt' , 'voc' , 'wav' , '8svx' , 'sb' , 'ub' ,或 'ul' 。 sampling_rate will be either the actual value or 0 if unknown or difficult to decode. Similarly, channels will be either the number of channels or 0 if it cannot be determined or if the value is difficult to decode. The value for frames will be either the number of frames or -1 . The last item in the tuple, bits_per_sample , will either be the sample size in bits or 'A' for A-LAW or 'U' for u-LAW.
namedtuple()
filetype
framerate
nchannels
nframes
sampwidth
'aifc'
'aiff'
'au'
'hcom'
'sndr'
'sndt'
'voc'
'wav'
'8svx'
'sb'
'ub'
'ul'
0
-1
'A'
'U'
Determines the type of sound data stored in the file filename 使用 whathdr() . If it succeeds, returns a namedtuple as described above, otherwise None 被返回。
whathdr()
None
3.5 版改变: 将结果从元组更改为命名元组。
Determines the type of sound data stored in a file based on the file header. The name of the file is given by filename . This function returns a namedtuple as described above on success, or None .
The following sound header types are recognized, as listed below with the return value from whathdr() :和 what() :
what()
值
Sound header format
A list of functions performing the individual tests. Each function takes two arguments: the byte-stream and an open file-like object. When what() is called with a byte-stream, the file-like object will be None .
The test function should return a string describing the image type if the test succeeded, or None if it failed.
范例:
>>> import sndhdr >>> imghdr.what('bass.wav') 'wav' >>> imghdr.whathdr('bass.wav') 'wav'
spwd — 影子口令数据库
spwd
键入搜索术语或模块、类、函数名称。