-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyfetch.py
More file actions
28 lines (24 loc) · 838 Bytes
/
pyfetch.py
File metadata and controls
28 lines (24 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import psutil
import platform
import socket
tux_art = [
" .--.",
" |o_o |",
" |:_/ |",
" // \\ \\",
" (| | )",
" /'\\_ _/`\\",
" \\___)=(___/"
]
info_lines = [
f"Ядро: {platform.system()} {platform.release()}",
f"Имя хоста: {socket.gethostname()}",
f"Физических ядер: {psutil.cpu_count(logical=False)}",
f"Логических ядер: {psutil.cpu_count(logical=True)}",
f"Оперативная память: {round(psutil.virtual_memory().total / (1024**3), 2)} GB"
]
art_width = max(len(line) for line in tux_art) + 4
for i in range(max(len(tux_art), len(info_lines))):
art = tux_art[i] if i < len(tux_art) else ""
info = info_lines[i] if i < len(info_lines) else ""
print(art.ljust(art_width) + info)