<commit_before>

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

print('Connecting 163.com...')
s.connect(('www.liaoxuefeng.com', 80))

print('Send GET request...')
s.send(b'GET / HTTP/1.1\r\nHost: www.liaoxuefeng.com\r\nConnection: close\r\n\r\n')

buffer = []

print('Receiving data...')
while True:
    d = s.recv(1024)
    if d:
        buffer.append(d)
    else:
        break

data = b''.join(buffer)

s.close()

print('Printing...')
header, html = data.split(b'\r\n\r\n', 1)
print(header.decode('utf-8'))

with open('python.html', 'wb') as f:
    f.write(html)
<commit_msg>correct learn_tcp.py<commit_after>

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

print('Connecting sina.com.cn...')
s.connect(('www.sina.com.cn', 80))

print('Send GET request...')
s.send(b'GET / HTTP/1.1\r\nHost: www.sina.com.cn\r\nConnection: close\r\n\r\n')

buffer = []

print('Receiving data...')
while True:
    d = s.recv(1024)
    if d:
        buffer.append(d)
    else:
        break

data = b''.join(buffer)

s.close()

print('Printing...')
header, html = data.split(b'\r\n\r\n', 1)
print(header.decode('utf-8'))

with open('sina.html', 'wb') as f:
    f.write(html)

{'fraction_non_alphanumeric': 0.2074688796680498, 'fraction_numerical': 0.019087136929460582, 'mean_word_length': 3.2464788732394365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7605897', 'n_tokens_mistral': 517, 'n_tokens_neox': 497, 'n_words': 89}