From 96ddc09872640798736b1d5d289726e9c7e0e6c5 Mon Sep 17 00:00:00 2001 From: Markintosh Date: Tue, 22 Dec 2020 00:55:22 +0800 Subject: [PATCH 1/2] hello --- hello.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 hello.txt diff --git a/hello.txt b/hello.txt new file mode 100644 index 0000000..c6a5759 --- /dev/null +++ b/hello.txt @@ -0,0 +1,3 @@ +hello bro + im using vim to creat this txt. + -- Gitee From 7f9fc8ef8f8a0b9ede1b03a59455a18821e75822 Mon Sep 17 00:00:00 2001 From: Markintosh Date: Tue, 22 Dec 2020 22:11:21 +0800 Subject: [PATCH 2/2] open fill as utf-8 --- baidu-spider/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baidu-spider/main.py b/baidu-spider/main.py index d50d75f..1f07eb7 100644 --- a/baidu-spider/main.py +++ b/baidu-spider/main.py @@ -31,7 +31,7 @@ def extract_info(html): def save_data(filename, data): # open a file named as below, and file mode is append, `a` for short - with open(filename + ".txt", 'a') as f: + with open(filename + ".txt", 'a',encoding='utf-8') as f: # itrate the result from the data list for one_data in data: # write each line of data then end with a line breaker -- Gitee