# ---
# 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
# ---

import csv
from io import StringIO
with open('/Users/yetongxue/Downloads/网站管理.csv')
reader = csv.reader(f, delimiter=',')
for index,row in enumerate(reader):
    if index == 0:
        continue
    print(row)

import tldextract
result = tldextract.extract('http://*.sometime')
result

from queue import PriorityQueue
import numpy as np
q = PriorityQueue(5)
arr = np.random.randint(1, 20, size=5)
arr

a = [[1,2], [3,4]]
a.reverse()
a

bin(int('2000000000000000004008020', 16))

len('10000000000000000000000000000000000000000000000000000000000000000000000100000000001000000000100000')

bin(int('00000000000004008020', 16))

len('100000000001000000000100000')

root = {}
node = root
for char in 'qwerasdf':
    node = node.setdefault(char, {})
node['#'] = '#'
root

import datetime
t = 1531732030883 * 0.001
datetime.datetime.fromtimestamp(1531732030883 * 0.001)
today 

import collections
dic = collections.OrderedDict()
dic[1] = 1
dic[2] = 2
dic

dic.popitem(last=False)

# +
import datetime
today = datetime.datetime.now().date()
update_time = datetime.datetime.strptime('2020-08-07 23:20:10', '%Y-%m-%d %H:%M:%S').date()
if today - update_time > datetime.timedelta(days=7):
    print(1)
(today - update_time).days  


'1'.strip().startswith('=')


# +
def check_row(row):
    data = []
    for i in row:
        i = i.strip()
        while i.startswith('='):
            i = i[1:]
        data.append(i)
    return data

check_row(['12', ' ==12', '1=1'])
# -

import re
res = re.match('^=+\s.', '=ab')
res

cc_ai = {
                        'normal': 'JS',
                        'low': 'JS',
                        'middle': 'JS',
                        'high': 'JSPAGE'
                    }
cc_ai

import datetime
start = datetime.datetime.now()
end = datetime.datetime.strptime('2020-09-24T07:14:04.252394', '%Y-%m-%dT%H:%M:%S.%f')
datetime.datetime.strptime(str(start.date()), '%Y-%m-%d') - datetime.timedelta(days=7)
isinstance(datetime.datetime.now(), datetime.datetime)

''.join('\t\ra-_sdf\n a sdf '.split())

SITE_MODULE = [
        'app_ipv6', 'site_shield', 'subdomain_limit', 'custom_page',
        'app_extra', 'service_charge', 'app_ipv6_defend', 'privacy_shield',
        'app_ipv6_custom', 'app_subdomain_limit', 'app_ip_limit', 'app_bandwidth',
        'app_subuser', 'batch', 'service_charge', 'cn2_line', 'site_shield_monitor',
        'app_httpdns_1k', 'app_domain_limit'
    ]
SITE_MODULE

''.join('a, \rd'.replace(',', '，').split())

# +
from docxtpl import DocxTemplate

path = '/Users/yetongxue/Downloads/test1.docx'
save_path = '/Users/yetongxue/Downloads/test1_save.docx'
template = DocxTemplate(path)
data = {'sites':  [{'domain':'asdf'},{'domain':'asdf2323'}]}
template.render(context=data)
template.save(save_path)
# -

import json
json.dumps([{'chargeType': 'plan', 'number': 1, 'expireTime': '2021-04-23', 'chargeId': '604d75cc261b3b0011a1a496'}, {'chargeType': 'additionPackage', 'number': 1, 'expireTime': '2021-04-23', 'chargeId': '604d75cd261b3b0011a1a498'}])
    

import commonds
status, output = commands.getstatusoutput('date')
# 2016年 06月 30日 星期四 19:26:21 CST
status, output

import os
res = os.popen('dig -x fc00:db20:35b:7399::5').read()
if 'intra.jiasule.com' in res:
    print('ok')
res

StarcoderdataJupyterScriptsDedupFiltered