From a1ef8e2365b3586649741ce43a4029e740546522 Mon Sep 17 00:00:00 2001 From: a Date: Wed, 19 Apr 2023 15:56:17 +0800 Subject: [PATCH] Changes --- weight-rank.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/weight-rank.md b/weight-rank.md index 204f72e..590dc75 100644 --- a/weight-rank.md +++ b/weight-rank.md @@ -10,4 +10,15 @@ data1.extend(sort_site(data.charge)) # 打乱 random.shuffle(data.miao_zhan) +``` + +```python +def sort_site(items, gfw=True): + items = sorted(items, key=lambda x: x.weight, reverse=True) + if gfw: + items_g = [x for x in items if x.gfw == 1] + items_g.extend([x for x in items if x.gfw != 1]) + items = items_g + return items + ``` \ No newline at end of file