且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在MS Azure中为我的Blob存储中的Blob提取上次修改日期

更新时间:2023-02-14 21:22:55

听起来好像您想在Azure ML Studio中使用Python获取Azure上Blob的last_modified属性.请尝试使用下面的代码.

It sounds like that you want to get the last_modified property of a blob on Azure using Python in Azure ML Studio. Please try to use the code below.

for blob in generator:
    last_modified = blob.properties.last_modified
    print(last_modified)

如果您不确定某个属性是否存在(例如,如下所示),则可以尝试在Python交互式env中编写<object>.__dict__的代码,以显示Python对象的属性.

And you can try to code <object>.__dict__ in Python interactive env to show the properties of a Python object if you are not sure what property whether or not exists, for example as below.

# Show the properties of a Blob object
>>> blob.__dict__
{'content': '', 'metadata': {}, 'snapshot': None, 'name': 'test.tmp',
 'properties': <azure.storage.blob.models.BlobProperties object at 0x7f4f8f870110>}
# Show the properties of the BlobProperties Object
>>> blob.properties.__dict__
{'content_length': 99831, 'blob_type': 'BlockBlob', 'append_blob_committed_block_count': None, 
 'last_modified': datetime.datetime(2016, 11, 23, 5, 46, 10, tzinfo=tzutc()), 'content_range': None, 'etag': '"0x8D4136407173436"', 'page_blob_sequence_number': None, 'content_settings': <azure.storage.blob.models.ContentSettings object at 0x7f4f8f870510>, 'copy': <azure.storage.blob.models.CopyProperties object at 0x7f4f8f870650>, 'lease': <azure.storage.blob.models.LeaseProperties object at 0x7f4f8f870810>}