Просмотр исходного кода

211003 修改 removeprefix 語法

yukyo0821 3 лет назад
Родитель
Сommit
8a384505d4
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      backstage/blogs/routes.py

+ 3 - 3
backstage/blogs/routes.py

@@ -63,9 +63,9 @@ def refreshFur():
                 if 'title:' in line:
                     tmpfurniture['title'] = re.split('"|\n', line)[1]
                 if 'date:' in line:
-                    tmpfurniture['date'] = re.split(':"|\n', line)[0].removeprefix('date: ')
+                    tmpfurniture['date'] = re.split(':"|\n', line)[0][6:]
                 if 'draft:' in line:
-                    tmpfurniture['draft'] = re.split(':"|\n', line)[0].removeprefix('draft: ')
+                    tmpfurniture['draft'] = re.split(':"|\n', line)[0][7:]
                 if 'type:' in line:
                     tmpfurniture['type'] = re.split('"|\n', line)[1]
                 if 'url:' in line:
@@ -75,7 +75,7 @@ def refreshFur():
                 if 'tags:' in line:
                     tmpfurniture['tags'] = re.split('"|\n', line)[1]
         # 避免加入類別項目
-        if tmpfurniture['type'] != tmpfurniture['url'].removeprefix('/'):
+        if tmpfurniture['type'] != tmpfurniture['url'][1:]:
             furnitures.append(tmpfurniture)