xxxxxxxxxx
import os
for filename in os.listdir(directory):
if filename.endswith(".asm") or filename.endswith(".py"):
# print(os.path.join(directory, filename))
continue
else:
continue
xxxxxxxxxx
import os
directory = 'the/directory/you/want/to/use'
for filename in os.listdir(directory):
if filename.endswith(".txt"):
#do smth
continue
else:
continue
xxxxxxxxxx
import os
for filename in os.listdir(directory):
if filename.endswith(".asm") or filename.endswith(".py"):
# print(os.path.join(directory, filename))
continue
else:
continue
xxxxxxxxxx
import os
folder_path = '/path/to/your/folder' # Replace this with the path to your folder
# Check if the folder exists
if os.path.exists(folder_path) and os.path.isdir(folder_path):
# Loop through the files in the folder
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
# Check if the item is a file (not a subdirectory)
if os.path.isfile(file_path):
print("File:", file_path)
else:
print(f"The folder '{folder_path}' does not exist or is not a directory.")
xxxxxxxxxx
import os
for filename in os.listdir("/path/to/dir/"):
if filename.endswith(".asm") or filename.endswith(".py"):
# print(os.path.join(directory, filename))
continue
else:
continue
xxxxxxxxxx
basepath = "pathtodir/DataFiles/"
for filename in os.listdir(basepath):
if filename.endswith(".log"):
print(os.path.join("./DataFiles", filename))
with open(basepath + filename) as openfile:
for line in openfile:
..