re.compile() 将正则表达式编译成一个Pattern规则对象,单独使用compile 没有意义,他生成的是一个规则,需要match ,search ,findall等去使用这个规则
指定位置开始截取双引号里面的内容
string_str = '/dev/sda: BLOCK_SIZE="512" UUID="1234567890" TYPE="ntfs" '
pattern = re.compile(r'TYPE=\"(.*?)\"')
type_string = re.findall(pattern, string_str)
print("type_string=%s" % type_string)
#输出
type_string = ['ntfs']