📅  最后修改于: 2023-12-03 14:46:37.453000             🧑  作者: Mango
turtle.write_docstringdict()
函数是Python turtle库中的一个函数,用于将指定模块或对象的docstring信息以表格形式输出到屏幕或文件中。
turtle.write_docstringdict(dictionary, mode='markdown')
dictionary
:字典类型,表示要输出的对象或模块的docstring信息。mode
:指定输出的格式,支持Markdown格式和reStructuredText格式。该函数没有返回值,将docstring信息直接输出到屏幕或文件。
下面是一个例子,调用write_docstringdict
函数输出Python内置math
模块的docstring信息,并以Markdown格式输出到屏幕上。
import math
import turtle
turtle.write_docstringdict(math.__dict__)
输出结果:
| atan2(y, x) | Return the arc tangent (measured in radians) of y/x. Unlike atan(y/x), the signs of both x and y are considered. | | :-------------- | :------------------------------------------------------------------------------------------------------------------------ | | ceil(x) | Return the ceiling of x as a float, the smallest integer value greater than or equal to x. | | comb(n, k) | Number of ways to choose k items from n items without repetition and without order. | | copysign(x, y) | Return x with the sign of y. On a platform that supports signed zeros, copysign(1.0,-0.0) returns -1.0. | | cos(x) | Return the cosine of x (measured in radians). | | cosh(x) | Return the hyperbolic cosine of x. | | degrees(x) | Convert angle x from radians to degrees. | | dist(p, q) | Return the Euclidean distance between two points p and q. | | erf(x) | Error function at x. | | erfc(x) | Complementary error function at x. | | exp(x) | Return e raised to the power of x. | | expm1(x) | Return exp(x)-1. This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x. | | fabs(x) | Return the absolute value of the float x. | | factorial(x) | Find x!. Raise a ValueError if x is negative or non-integral. | | floor(x) | Return the floor of x as a float, the largest integer value less than or equal to x. | | fmod(x, y) | Return fmod(x, y), according to platform C. x % y may differ. | | frexp(x) | Return the mantissa and exponent of x as the pair (m, e). m is a float and e is an int, such that x = m * 2.e. | | fsum(iterable) | Return an accurate floating point sum of values in the iterable. | | *gcd(integers) | Return the greatest common divisor of the specified integer arguments. | | *hypot(coordinates) | Return the Euclidean distance, sqrt(sum(x2 for x in coordinates)), between two or more points. | | *isclose(a, b, , rel_tol=1e-09, abs_tol=0.0) | Determine whether two floating point numbers are close in value. | | isfinite(x) | Return True if x is neither an infinity nor a NaN (not a number). | | isinf(x) | Return True if x is a positive or negative infinity. | | isnan(x) | Return True if x is a NaN (not a number). | | isqrt(n) | Return the integer square root of the nonnegative integer n. | | ldexp(x, i) | Return x * (2**i). | | lgamma(x) | Natural logarithm of absolute value of Gamma function at x. | | log(x[, base]) | Return the logarithm of x to the given base. If the base not specified, returns the natural logarithm (base e) of x. | | log10(x) | Return the base-10 logarithm of x. This is usually more accurate than log(x, 10). | | log1p(x) | Return the natural logarithm of 1+x (base e). The result is computed in a way which is accurate for x near zero. | | log2(x) | Return the base-2 logarithm of x. This is usually more accurate than log(x, 2). | | modf(x) | Return the fractional and integer parts of x. Both results carry the sign of x and are floats. | | perm(n, k=None) | Number of ways to choose k items from n items with order and without repetition. | | pow(x, y) | Return x raised to the power y. Exceptional cases are handled as follows: | | *prod(iterable, , start=1) | Calculate the product of all the elements in the input iterable. | | radians(x) | Convert angle x from degrees to radians. | | remainder(x, y) | Return the IEEE 754-style remainder of x with respect to y. | | sin(x) | Return the sine of x (measured in radians). | | sinh(x) | Return the hyperbolic tangent of x. | | sqrt(x) | Return the square root of x. | | tan(x) | Return the tangent of x (measured in radians). | | tanh(x) | Return the hyperbolic tangent of x. | | trunc(x) | Return the Real value x truncated to an Integral (usually a long integer). |