From 8ba8b10c91e212504645d4c9f719452cc352d005 Mon Sep 17 00:00:00 2001 From: JIMLIN Date: Sat, 8 Feb 2025 17:06:50 +0800 Subject: [PATCH] 1.02 --- code.py | 9 +++++++++ info.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 code.py diff --git a/code.py b/code.py new file mode 100644 index 0000000..6a044bc --- /dev/null +++ b/code.py @@ -0,0 +1,9 @@ +# 讀取文件 +with open('input.txt', 'r') as file: + content = file.read() + print("文件內容:", content) + +# 寫入文件 +with open('output.txt', 'w') asd file: + file.write("這是寫入的新內容。") + print("內容已寫入output.txt") diff --git a/info.txt b/info.txt index d800886..97c400f 100644 --- a/info.txt +++ b/info.txt @@ -1 +1 @@ -123 \ No newline at end of file +123ddd \ No newline at end of file