exra token

julia> function getlayername(file)
           layers=get(file,"layers","")
           meta=get(file,"meta","")
           for la in layers    
               println(la["name"])
           end
       end

ERROR: syntax: extra token “getlayername” after end of expression

有 typo,function 打错了

error  = "funciton getlayername(file)"
normal = "function getlayername(file)"

julia> error == normal
false

julia> for i in 1:length(error)
           if error[i] != normal[i]
               println(i, ' ', error[i])
           end
       end
5 i
6 t

sorry, the name is correct. when i edit it, i miss it. And when the function has no spelling error, where is the problem. please help me.

更正了错误之后,我这边定义这个函数是没有问题的。也没有报错

julia> function getlayername(file)
           layers=get(file,"layers","")
           meta=get(file,"meta","")
           for la in layers
               println(la["name"])
           end
       end
getlayername (generic function with 1 method)

没法复现你遇到的错误。

好的,我搞定了。谢谢了