Yahoo Αναζήτηση Διαδυκτίου

Αποτελέσματα Αναζήτησης

  1. In Python 3.4 and above, you can use the object oriented pathlib module interface which includes wrappers for much of the os module. Here is an example of getting the file stats. >>> import pathlib. >>> fname = pathlib.Path('test.py') >>> assert fname.exists(), f'No such file: {fname}' # check that the file exists.

  2. 8 Answers. Sorted by: 615. While not using datetime, this solves your problem (answers your question) of getting a string with the current time and date format you specify: import time. timestr = time.strftime("%Y%m%d-%H%M%S") print timestr. yields: 20120515-155045. so your filename could append or use this string. edited May 15, 2012 at 22:22.

  3. 15 Μαρ 2024 · You can use functions from the time module and datetime module to get the file creation and modification of date or time.

  4. 9 Αυγ 2023 · In Python, you can use the os and pathlib modules from the standard library to get file timestamp information, such as the creation, modification, and access time. It is provided in Unix time (Epoch time, Posix time) but can be converted to a datetime object.

  5. 24 Δεκ 2021 · Get file modification and creation datetime in Python using the getmtime(), getctime(), st_time, st_ctime methods of an OS and pathlib module

  6. 13 Ιαν 2024 · This tutorial covered how to handle file creation dates and times in Python, discuss the differences across operating systems, and illustrate a few methods and libraries that can be used to retrieve this information.

  7. 28 Δεκ 2022 · That means that you can use Python to get information about files, such as their size, creation date, and more. In this post, we'll learn how you can use Python to get details of a file on your file system.

  1. Γίνεται επίσης αναζήτηση για