84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
try: r = requests.get('http://www.baidu.com',timeout=30) r.raise_for_status() r.encoding = r.apparent_encoding return r.text except: return '我怎么知道又错了' SyntaxError: 'return' outside function
勇敢站起来快步向前冲是你唯一的出路
python Why does it report an error when using return? -PHP Chinese website Q&A-python Why do I get an error when using return? -PHP Chinese website Q&A
Let’s take a look and learn.
import requeststry: r = requests.get('http://www.baidu.com',timeout=30) r.raise_for_status() r.encoding = r.apparent_encodingexcept: print('我怎么知道又错了') print(r.text)return是在函数中返回
python Why does it report an error when using return? -PHP Chinese website Q&A-python Why do I get an error when using return? -PHP Chinese website Q&A
Let’s take a look and learn.