-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MLittlescp/dlittle-initial-branch-
Create Python - Data Extraction Project.py
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# let's start off by importing operating systems | ||
import os | ||
|
||
# Get the list of files in the working directory | ||
files = os.listdir() | ||
|
||
# Create a list to store the file information | ||
file_info_list = [] | ||
|
||
# Loop through the files and gather information | ||
for file in files: | ||
if os.path.isfile(file): | ||
file_info = { | ||
"name": file, | ||
"size": os.path.getsize(file) | ||
} | ||
file_info_list.append(file_info) | ||
|
||
# Print the list of dictionaries | ||
print(file_info_list) | ||
|