原创 使用requests和正則表達式爬取貓眼電影Top100

import requests import re import json from requests.exceptions import RequestException def get_one_page(url): t

原创 (筆記) break 與continue 的區別

a= True while a: b = input('type something') if b =='1': a=False else: pass print('st

原创 (筆記)python文件讀寫

file = open('my file.txt','r') m = file.readline() list=[1,2,3] print(m) 讀出第一行 file = open('my file.txt','r') m = f

原创 python print的學習筆記和列舉

str=hello world print=(str) 運行出現語法錯誤 str="hello world" print=(str) hello world a=2+3 print(a) 5 a="2+3" print(a

原创 (筆記)全局變量和局部定義

def fun(): a=10 print(a) return a+100 print(fun()) 10 110 def fun(): a=10 return a+100 pri