From af58097be2a74ad1ea613822be576c097f47ee70 Mon Sep 17 00:00:00 2001 From: Edit-Mr Date: Mon, 6 Nov 2023 10:59:09 +0800 Subject: [PATCH] finished --- index.html | 25 +++++++++++-------------- "\347\260\241\345\240\261.md" | 25 ++++++++++--------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/index.html b/index.html index 5671010..e730865 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ * @size 16:9 1280px 720px * @size 4:3 960px 720px */div#\:\$p>svg>foreignObject>section{word-wrap:break-word;--color-background:#fdfcff;--color-background-code:#f2f1f4;--color-background-paginate:rgba(32,34,40,.05);--color-foreground:#202228;--color-highlight:#009dd5;--color-highlight-hover:#087eaa;--color-highlight-heading:#33b1dd;--color-header:rgba(32,34,40,.4);--color-header-shadow:rgba(253,252,255,.8);background:var(--color-background);flex-flow:column nowrap;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-size:40px;height:720px;justify-content:center;letter-spacing:3px;line-height:1.4;padding:30px 70px;position:relative;text-align:center;width:1280px;z-index:0}div#\:\$p>svg>foreignObject>section{--marpit-root-font-size:40px}div#\:\$p>svg>foreignObject>section,div#\:\$p>svg>foreignObject>section:after{color:var(--color-foreground);display:flex}div#\:\$p>svg>foreignObject>section:after{align-items:flex-end;background:linear-gradient(-45deg,var(--color-background-paginate) 50%,transparent 50%);background-size:cover;font-size:.6em;height:80px;justify-content:flex-end;padding:30px;text-align:right;text-shadow:0 0 5px var(--color-background);width:80px}div#\:\$p>svg>foreignObject>section:after{--marpit-root-font-size:.6em}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) :is(pre,marp-pre) code.hljs{display:block;overflow-x:auto;padding:1em}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) code.hljs{padding:3px 5px}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs{background:#fff;color:#000}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-addition,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-meta,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-string,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-symbol,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-template-tag,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-template-variable{color:#756bb1}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-comment,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-quote{color:#636363}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-bullet,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-link,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-literal,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-number,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-regexp{color:#31a354}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-deletion,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-variable{color:#88f}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-built_in,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-doctag,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-keyword,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-name,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-section,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-selector-class,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-selector-id,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-selector-tag,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-strong,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-tag,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-title,div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-type{color:#3182bd}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-emphasis{font-style:italic}div#\:\$p>svg>foreignObject>section:where(:not(.invert)) .hljs-attribute{color:#e6550d}div#\:\$p>svg>foreignObject>section:where(.invert){--color-background:#202228;--color-background-code:#2b2d33;--color-background-paginate:hsla(0,0%,100%,.05);--color-foreground:#fff;--color-highlight:#60d0f0;--color-highlight-hover:#88dcf4;--color-highlight-heading:#80d9f3;--color-header:hsla(0,0%,100%,.4);--color-header-shadow:rgba(32,34,40,.8)}div#\:\$p>svg>foreignObject>section:where(.invert) :is(pre,marp-pre) code.hljs{display:block;overflow-x:auto;padding:1em}div#\:\$p>svg>foreignObject>section:where(.invert) code.hljs{padding:3px 5px}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs{background:#222;color:#fff}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-comment,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-quote{color:#777}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-built_in,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-bullet,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-deletion,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-link,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-literal,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-meta,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-number,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-params,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-regexp,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-symbol,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-tag,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-template-variable,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-variable{color:#ab875d}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-attribute,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-name,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-section,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-selector-class,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-selector-id,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-title,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-type{color:#9b869b}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-addition,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-keyword,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-selector-tag,div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-string{color:#8f9c6c}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-emphasis{font-style:italic}div#\:\$p>svg>foreignObject>section:where(.invert) .hljs-strong{font-weight:700}div#\:\$p>svg>foreignObject>section>:first-child,div#\:\$p>svg>foreignObject>section[data-header]>:nth-child(2){margin-top:0}div#\:\$p>svg>foreignObject>section>:last-child,div#\:\$p>svg>foreignObject>section[data-footer]>:nth-last-child(2){margin-bottom:0}div#\:\$p>svg>foreignObject>section blockquote,div#\:\$p>svg>foreignObject>section p{margin:0 0 15px}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section :is(h2,marp-h2),div#\:\$p>svg>foreignObject>section :is(h3,marp-h3),div#\:\$p>svg>foreignObject>section :is(h4,marp-h4),div#\:\$p>svg>foreignObject>section :is(h5,marp-h5),div#\:\$p>svg>foreignObject>section :is(h6,marp-h6){margin:15px 0 30px}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1) strong,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2) strong,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3) strong,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4) strong,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5) strong,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6) strong{color:var(--color-highlight-heading);font-weight:inherit}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h2,marp-h2)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h3,marp-h3)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h4,marp-h4)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h5,marp-h5)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h6,marp-h6)::part(auto-scaling){max-height:660px}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1){font-size:2em}div#\:\$p>svg>foreignObject>section :is(h2,marp-h2){font-size:1.7em}div#\:\$p>svg>foreignObject>section :is(h3,marp-h3){font-size:1.4em;letter-spacing:2px}div#\:\$p>svg>foreignObject>section :is(h4,marp-h4){font-size:1.2em;letter-spacing:2px}div#\:\$p>svg>foreignObject>section :is(h5,marp-h5){font-size:1em;letter-spacing:1px}div#\:\$p>svg>foreignObject>section :is(h6,marp-h6){font-size:.8em;letter-spacing:1px}div#\:\$p>svg>foreignObject>section footer,div#\:\$p>svg>foreignObject>section header{color:var(--color-header);font-size:.45em;left:70px;letter-spacing:1px;position:absolute;right:70px;text-shadow:0 1px 0 var(--color-header-shadow);z-index:1}div#\:\$p>svg>foreignObject>section header{top:30px}div#\:\$p>svg>foreignObject>section footer{bottom:30px}div#\:\$p>svg>foreignObject>section a{color:var(--color-highlight);text-decoration:none}div#\:\$p>svg>foreignObject>section a:hover{color:var(--color-highlight-hover);text-decoration:underline}div#\:\$p>svg>foreignObject>section ol,div#\:\$p>svg>foreignObject>section ul{margin:0 auto;text-align:left}div#\:\$p>svg>foreignObject>section>ol,div#\:\$p>svg>foreignObject>section>ul{margin-bottom:15px}div#\:\$p>svg>foreignObject>section code{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;letter-spacing:0}div#\:\$p>svg>foreignObject>section :not(:is(pre,marp-pre))>code,div#\:\$p>svg>foreignObject>section>code{background:var(--color-background-code);color:var(--color-foreground);margin:-.2em .2em .2em;padding:.2em}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre){--preserve-aspect-ratio:xMidYMid meet;filter:drop-shadow(0 4px 4px rgba(0,0,0,.2));font-size:70%;line-height:1.15;margin:15px 0 30px;text-align:left}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre)::part(auto-scaling){max-height:570px}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre)>code{background:var(--color-background-code);box-sizing:content-box;color:var(--color-foreground);display:block;margin:0 auto;min-width:456px;padding:.4em .6em}div#\:\$p>svg>foreignObject>section[data-size="4:3"] :is(pre,marp-pre)>code{min-width:328px}div#\:\$p>svg>foreignObject>section table{border-collapse:collapse;margin:0 auto 15px}div#\:\$p>svg>foreignObject>section table>tbody>tr>td,div#\:\$p>svg>foreignObject>section table>tbody>tr>th,div#\:\$p>svg>foreignObject>section table>thead>tr>td,div#\:\$p>svg>foreignObject>section table>thead>tr>th{padding:.15em .5em}div#\:\$p>svg>foreignObject>section table>thead>tr>td,div#\:\$p>svg>foreignObject>section table>thead>tr>th{border-bottom:3px solid}div#\:\$p>svg>foreignObject>section table>tbody>tr:not(:last-child)>td,div#\:\$p>svg>foreignObject>section table>tbody>tr:not(:last-child)>th{border-bottom:1px solid}div#\:\$p>svg>foreignObject>section blockquote{font-size:90%;line-height:1.3;padding:0 2em;position:relative;z-index:0}div#\:\$p>svg>foreignObject>section blockquote:after,div#\:\$p>svg>foreignObject>section blockquote:before{content:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNNDQgMTkuMyAzOC45NCAwQzguMTQgOS41OSAwIDQwLjA1IDAgNTQuODNWMTAwaDQxLjQ3VjU0LjgzaC0yM2MtLjA0LS4yOC4yNS0yNy42NiAyNS41My0zNS41M3ptNTYgMEw5NC45NCAwQzY0LjE0IDkuNTkgNTYgNDAuMDUgNTYgNTQuODNWMTAwaDQxLjQ3VjU0LjgzaC0yM2MtLjA0LS4yOC4yNS0yNy42NiAyNS41My0zNS41M3oiIHN0eWxlPSJmaWxsOiM4ODg7b3BhY2l0eTouMzMiLz48L3N2Zz4=");height:auto;pointer-events:none;position:absolute;width:1em;z-index:-1}div#\:\$p>svg>foreignObject>section blockquote:before{left:0;top:0}div#\:\$p>svg>foreignObject>section blockquote:after{bottom:0;right:0;transform:rotate(180deg)}div#\:\$p>svg>foreignObject>section blockquote>:last-child{margin-bottom:0}div#\:\$p>svg>foreignObject>section mark{background:transparent;color:var(--color-highlight)}div#\:\$p>svg>foreignObject>:where(section):not([root]){--color-background-code:#222222;--color-foreground:#FFF}div#\:\$p>svg>foreignObject>section .language-python,div#\:\$p>svg>foreignObject>section marp-pre{color:#FFF;padding:1.2em!important}div#\:\$p>svg>foreignObject>section code{border-radius:20px}div#\:\$p>svg>foreignObject>section .small{font-size:0.5em}div#\:\$p>svg>foreignObject>section section.small{--marpit-root-font-size:0.5em}div#\:\$p>svg>foreignObject>section .l{text-align:left}div#\:\$p>svg>foreignObject>section[data-marpit-pagination="2"]{}div#\:\$p>svg>foreignObject>section .em{background:#00000088;width:100%;height:100%;position:absolute;top:50%;left:50%;display:flex;justify-content:center;flex-direction:column;transform:translate(-50%,-50%)}div#\:\$p>svg>foreignObject>section .em :is(h5,marp-h5){margin-bottom:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure>figcaption{position:absolute;border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}
-

Python 爬蟲

+

Python 爬蟲

112中電會聯合迎新

@@ -904,24 +904,21 @@

打開圖片

-

迴圈

- -

一次下載多張圖片

+

一次下載多張圖片

import requests
 image_links = [
+    "https://picsum.photos/200/300","https://picsum.photos/200/300","https://picsum.photos/200/300",
     "https://picsum.photos/200/300","https://picsum.photos/200/300",
-    "https://picsum.photos/200/300","https://picsum.photos/200/300",
-    "https://picsum.photos/200/300",
 ]
 for index, link in enumerate(image_links):
-  try:
-            response = requests.get(link)
-            response.raise_for_status()
-            with open(f"image_{index+1}.jpg", "wb") as file:
-                file.write(response.content)
-            print(f"Image {index+1} downloaded successfully.")
-        except requests.exceptions.RequestException as e:
-            print(f"Error downloading image {index+1}: {e}")
+    try:
+        response = requests.get(link)
+        response.raise_for_status()
+        with open(f"image_{index+1}.jpg", "wb") as file:
+            file.write(response.content)
+        print(f"圖片{index+1}下載成功")
+    except requests.exceptions.RequestException as e:
+        print(f"圖片{index+1}下載失敗: {e}")
 
diff --git "a/\347\260\241\345\240\261.md" "b/\347\260\241\345\240\261.md" index 311e7dd..4e34ed9 100644 --- "a/\347\260\241\345\240\261.md" +++ "b/\347\260\241\345\240\261.md" @@ -67,8 +67,6 @@ backgroundImage: url("https://raw.githubusercontent.com/SCAICT/112-OP/main/img/s [elvismao.com](https://elvismao.com/) - - ![bg 100%](https://raw.githubusercontent.com/SCAICT/112-OP/main/img/EMr.png) --- @@ -1042,28 +1040,25 @@ else: --- -# 迴圈 +# 一次下載多張圖片 -一次下載多張圖片 - ```python import requests image_links = [ + "https://picsum.photos/200/300","https://picsum.photos/200/300","https://picsum.photos/200/300", "https://picsum.photos/200/300","https://picsum.photos/200/300", - "https://picsum.photos/200/300","https://picsum.photos/200/300", - "https://picsum.photos/200/300", ] for index, link in enumerate(image_links): - try: - response = requests.get(link) - response.raise_for_status() - with open(f"image_{index+1}.jpg", "wb") as file: - file.write(response.content) - print(f"Image {index+1} downloaded successfully.") - except requests.exceptions.RequestException as e: - print(f"Error downloading image {index+1}: {e}") + try: + response = requests.get(link) + response.raise_for_status() + with open(f"image_{index+1}.jpg", "wb") as file: + file.write(response.content) + print(f"圖片{index+1}下載成功") + except requests.exceptions.RequestException as e: + print(f"圖片{index+1}下載失敗: {e}") ``` ---