# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # The colors are at
# * https://xkcd.com/color/rgb.txt

import requests

url = r"https://xkcd.com/color/rgb.txt"
response = requests.get(url)

lines = response.text.split('\n')
license = lines[0]
license

d = dict_by_color_names = dict(spl[:2] for spl in (line.split('\t') for line in lines[1:]) if len(spl) >= 2)

len(dict_by_color_names)

d['red'], d['green'], d['blue']

import matplotlib
for name, hex in matplotlib.colors.cnames.items():
    print(name, hex)



max(line.split('\t')[-1] for line in lines[1:])

min(len(line.split('\t')) for line in lines[1:])

[line for line in lines if len(line.split('\t')) == 2]

lines[-2]

len(d)

d = dict(spl[:2] for spl in (line.split('\t') for line in response.text.split('\n')) if len(spl) >= 2)

len(d)

list(d)[:5]

t1 = [line for line in response.text]
t1[:5]

len(response.text)

len(response.text.split('\n'))

print(response.text)



StarcoderdataJupyterScriptsDedupFiltered