Python IndentationError: expected an indented block 报错解决

照着课程敲的代码,def 这里反复报缩进的错,前后没有空格,没有缩进,为什么还指示在冒号后报错嘞?


def getTick(symbol):
    page= requests.get("https://qt.gtimg.cn/q=sz"+symbol)  
    stock_info = page.text
    #字符通过“~”间隔,获得list
    mt_info = stock_info.split("~")
    
    #float()将String和Integer转化为浮点数
    closing =float(mt_info[3]) 
    closing_yesterday = float(mt_info[4])
    opening = float(mt_info[5])
    high = float(mt_info[33])
    low = float(mt_info[34])
    
    trade_datetime = parser.parse(mt_info[30])
    
    tick=(closing,trade_datetime)
    
    return tick
def getTick(symbol):
  File "C:\Users\bln\AppData\Local\Temp\ipykernel_16864\1103336103.py", line 1
    def getTick(symbol):
                        ^
IndentationError: expected an indented block

我测试你这里的代码没问题,你再检查一下文件?

img