#
ping_res = Popen("ping vk.com -n 1", stdout=PIPE, stderr=STDOUT)
text = ''
for line in ping_res.stdout.readlines():
text += line.decode('cp866')
vk = re.search(r'Среднее = (\d+) мсек', text)
if vk:
print(f"{vk.groups()[0]} мс")