Discuss / Python / help(def)

help(def)

Topic source

再回首-知

#1 Created at ... [Delete] [Delete and Lock User]

我在Python里输入 help(def) ^ 回车后显示 SyntaxError: invalid syntax

输入 help(abs) 则显示函数解释 这是不是说明我的Python版本不支持定义函数

背景:Python 3.6.0 Windows 7

def是关键字,用来定义函数,并不是一个具体的函数。

再回首-知

#3 Created at ... [Delete] [Delete and Lock User]

我定义函数的时候卡住了 代码如下: def power(x, n): s = 1 while n > 0: n = n - 1 s = s * x return s

我按回车,就显示 Syntax Error:invalid Syntax

这是哪里的问题?谢谢了。

ZNnnnnnnnnan

#4 Created at ... [Delete] [Delete and Lock User]

没有语法错误啊

再回首-知

#5 Created at ... [Delete] [Delete and Lock User]

谢谢指导 问题已经解决 是编程方法的问题


  • 1

Reply