Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import platform
- import psutil
- # Gather system information
- system_info = {
- "OS": platform.system(),
- "OS Version": platform.version(),
- "Architecture": platform.architecture()[0],
- "Processor": platform.processor(),
- "CPU Cores": psutil.cpu_count(logical=False),
- "Logical CPUs": psutil.cpu_count(logical=True),
- "RAM (GB)": round(psutil.virtual_memory().total / (1024**3), 2),
- "Disk Space (GB)": round(psutil.disk_usage('/').total / (1024**3), 2)
- }
- # Define CSV file name
- csv_filename = "hardware_specs.csv"
- # Write to CSV
- with open(csv_filename, mode='w', newline='') as file:
- writer = csv.writer(file)
- writer.writerow(["Component", "Specification"])
- for key, value in system_info.items():
- writer.writerow([key, value])
- print(f"Hardware specs exported to {csv_filename}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement