问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

关于python的help功能问题

发布网友 发布时间:2022-04-22 13:05

我来回答

1个回答

热心网友 时间:2022-04-18 04:11

你好,首先你可以通过help(format)看到基本的信息,然后这个信息有提示,需要看更多的信息可以通过help('FORMATTING')。
如果你需要将相关的信息发送出来,可以用下面的代码:
import os
import sys

out = sys.stdout
sys.stdout = open("help.txt", "w")

help('FORMATTING')

sys.stdout.close()
sys.stdout = out

和填充,对齐的信息如下:
Most built-in types implement the following options for format
specifications, although some of the formatting options are only
supported by the numeric types.
A general convention is that an empty format string ("""") proces
the same result as if you had called "str()" on the value. A non-empty
format string typically modifies the result.
The general form of a *standard format specifier* is:
format_spec ::= [[fill]align][sign][#][0][width][grouping_option][.precision][type]
fill ::= <any character>
align ::= "<" | ">" | "=" | "^"
sign ::= "+" | "-" | " "
width ::= digit+
grouping_option ::= "_" | ","
precision ::= digit+
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
If a valid *align* value is specified, it can be preceded by a *fill*
character that can be any character and defaults to a space if
omitted. It is not possible to use a literal curly brace (p"{"q or
p"}"q) as the *fill* character in a formatted string literal or when
using the "str.format()" method. However, it is possible to insert a
curly brace with a nested replacement field. This limitation doesnot
affect the "format()" function.
The meaning of the various alignment options is as follows:
+-----------+------------------------------------------------------------+
| Option | Meaning |
+===========+============================================================+
| "'<'" | Forces the field to be left-aligned within the available |
| | space (this is the default for most objects). |
+-----------+------------------------------------------------------------+
| "'>'" | Forces the field to be right-aligned within the available |
| | space (this is the default for numbers). |
+-----------+------------------------------------------------------------+
| "'='" | Forces the padding to be placed after the sign (if any) |
| | but before the digits. This is used for printing fields |
| | in the form n+000000120o. This alignment option is only |
| | valid for numeric types. It becomes the default when n0o |
| | immediately precedes the field width. |
+-----------+------------------------------------------------------------+
| "'^'" | Forces the field to be centered within the available |
| | space. |
+-----------+------------------------------------------------------------+
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
...频数和频率成正比,2频数一定时,频率与总次数成反比,对不对_百度... ...总次数之间的关系是( ) A.频数越大,频率越大 B.总次数一定时,频数越... 实验的总次数、频数及频率三者的关系是( )A.频数越大,频率越大B.频数... 嘎牙鱼的做法大全 安无线网要用多少元网费要交多少元不用用了要不要交网费,想寻求大家的... 无线网费1年多少钱 "Hbr"作为“港”的缩写,其在英语中的使用频率和应用示例如何? 【车主点评:吉利汽车帝豪GL 使我荣华富贵】 请问,如果,家用,自动挡,帝豪gl,英朗,科沃兹,卡罗拉,轩逸,同等价位,建议... ...景点?既能休闲的时候看看又能长点知识@@谢谢各位了! 关于python的help功能提问 python help 怎么用 python的dir和help用法 Python中help()的用法 梦幻西游有SF么 请问梦幻出私服了吗,私服是什么意思 开个梦幻西游私服要多少钱 梦幻西游现在有SF吗? 梦幻西游现在有SF吗 梦幻有SF吗? 梦幻西游2真的有SF吗 梦幻sf现在有吗? 谁有好点的梦幻私服? 梦幻西游真的有SF吗 梦幻西游有私服SF吗? 梦幻西游到底有没有sf 《梦幻西游》的手游版有私服吗? 梦幻西游有SF吗? 梦幻sf怎么偷别人号 梦幻SF有吗? python中的“dir”和“help”作用是什么? Python怎么查看帮助信息 voviioo手机发微信右上角显示红色麦克风是什么意思? Python help函数命令怎么使用 idle python 怎么用help python的关于help的问题,如何将内容导出 苹果手机更新13.3 微信说话时候为什么出现小话筒? python可以采用help语句获取帮助信息吗 iphone 微信通话麦克风亮是开是关 python在中,如何给自己编写的库添加help python中help命令可以查看关键字信息吗 苹果6s微信有时无法录制语音,屏幕上方闪红光怎么办 《冥冥之外》txt全集下载 如何在命令行模式下查看Python帮助文档 有没有 刘能和赵四的笑话 python怎么退出help 404 Not Found python中语法中或者help出来的中括号什么意思 刘一手是什么电视剧的人物? 苹果手机微信按住说话发不了语音怎么办!