在python中获取文件详细信息

时间:2016-08-18 05:22:29

标签: python exif

我试图使用Python提取文件的详细信息。具体来说,当我右键单击一张照片并选择属性时,在弹出的菜单的详细信息选项卡下,有一大堆关于该文件的详细信息。我真正需要的是" People"细节。

这是有问题的菜单:

有没有一种很好的方法可以将字符串中的人物细节或其他东西?

有些人建议使用ExifRead。我试过了,但它并没有将Exif数据中的People标记拉出来。

1 个答案:

答案 0 :(得分:0)

这不是EXIF数据,而是Windows为Windows Property System中不同类型的对象填充的数据。

您关注的问题称为System.Photo.PeopleNames

propertyDescription
   name = System.Photo.PeopleNames
   shellPKey = PKEY_Photo_PeopleNames
   formatID = E8309B6E-084C-49B4-B1FC-90A80331B638
   propID = 100
   searchInfo
      inInvertedIndex = true
      isColumn = true
      isColumnSparse = true
      columnIndexType = OnDemand
      maxSize = 128
      mnemonics = people|people tag|people tags
   labelInfo
      label = People
      sortDescription
      invitationText = Add a people tag
      hideLabel = false
   typeInfo
      type = String
      groupingRange = Discrete
      isInnate = true
      canBePurged = true
      multipleValues = true
      isGroup = false
      aggregationType = Union
      isTreeProperty = false
      isViewable = true
      isQueryable (Vista) = false
      includeInFullTextQuery (Vista) = false
      searchRawValue (Windows 7) = true
      conditionType = String
      defaultOperation = Equal
   aliasInfo
      sortByAlias = None
      additionalSortByAliases = None
   displayInfo
      defaultColumnWidth = 11
      displayType = String
      alignment = Left
      relativeDescriptionType = General
      defaultSortDirection = Ascending
      stringFormat
         formatAs = General
      booleanFormat
         formatAs = YesNo
      numberFormat
         formatAs = General
         formatDurationAs = hh:mm:ss
      dateTimeFormat
         formatAs = General
         formatTimeAs = ShortTime
         formatDateAs = ShortDate
      enumeratedList
         defaultText
         useValueForDefault = False
         enum
            value
            text
         enumRange
            minValue
            setValue
            text
      drawControl
         control = Default
      editControl
         control = Default
      filterControl
         control = Default
      queryControl
         control = Default

要在Python中访问此信息,请使用win32com.propsys