iPython终端的函数定义中的换行符
使用%paste,iPython将函数定义中的换行符作为函数的结尾。当我从别人的机器上编写代码时,这不是问题。我浏览了配置文档和其他网站;不走运iPython终端的函数定义中的换行符,python,ipython,ipython-magic,python-config,Python,Ipython,Ipython Magic,Python Config,使用%paste,iPython将函数定义中的换行符作为函数的结尾。当我从别人的机器上编写代码时,这不是问题。我浏览了配置文档和其他网站;不走运 def get_sheet(filepath, sheet_name): book = open_workbook(filepath) for name in book.sheet_names(): if sheet_name in name.lower(): sheet_name = name
def get_sheet(filepath, sheet_name):
book = open_workbook(filepath)
for name in book.sheet_names():
if sheet_name in name.lower():
sheet_name = name
sheet = book.sheet_by_name(sheet_name)
return sheet
SyntaxError: 'return' outside function
非常感谢=)使用
%cpaste
,它需要两个破折号才能退出模式。您有什么版本的IPython?这对我来说很管用。