Untitled - Posted on February Wed 17th 9:10 PM (Never Expires) - Format: text - See newer version(s) of this paste titled "Untitled"
  1. import requests
  2. #引用requests库
  3. res = requests.get('https://localprod.pandateacher.com/python-manuscript/crawler-html/sanguo.md')
  4. #下载《三国演义》第一回,我们得到一个对象,它被命名为res
  5. novel=res.text
  6. #把Response对象的内容以字符串的形式返回
  7. k = open('《三国演义》.txt','a+')
  8. #创建一个名为《三国演义》的txt文档,指针放在文件末尾,追加内容
  9. k.write(novel)
  10. #写进文件中    
  11. k.close()
  12. #关闭文档

New Paste

Paste Options

Recent Pastes

4 days ago

Untitled

4 days ago

Untitled

38 days ago

Untitled

43 days ago

Untitled

43 days ago

Untitled

48 days ago

Hack_14578989

48 days ago

Hack_14578989

56 days ago

Untitled

59 days ago

Untitled

59 days ago

Untitled