首页 > 解决方案 > 如何使用 python 和 pyspark 获取镶木地板文件的创建日期?

问题描述

如何获取镶木地板文件的创建日期?

他们给了我镶木地板文件,我将它们存储在我的 Google Drive 中进行测试。我正在将 Google Colab 与 Python 和 Pyspark 一起使用。什么是正确的命令?

谢谢

标签: pythonpysparkgoogle-colaboratory

解决方案


我没有尝试过 colab,但 Databricks 以这种方式工作:

import os, time
path = '/local/file.parquet' # if you are on Databricks the adress could be dbfs:/mnt/local so you need replace to /dbfs/mnt/local/file.parquet
stat_info = os.stat(path)
print(stat_info)
print(stat_info.st_mtime)
print(time.ctime(stat_info.st_mtime))

希望对你有用


推荐阅读