关于字符串函数的交互式帮助 - howto [英] interactive help on string functions - howto

查看:95
本文介绍了关于字符串函数的交互式帮助 - howto的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




进入

help(''rstrip'')



帮助(''ljust'')


进入IDLE的shell窗口我只得到

没有找到Python文档......


我错过了什么吗?


感谢您的提示,

赫尔穆特。


-

Helmut Jarausch


Lehrstuhl fuer Numerische Mathematik

RWTH - 亚琛大学

D 52056德国亚琛

解决方案

Helmut Jarausch写道:


帮助(''rstrip'')

求助(''lust'')

进入IDLE的shell窗口我只得到
没有找到Python文档...

我错过了什么吗?

感谢您的提示,
Helmut。



确保你已经输入了字符串。然后你可以这样做:

help(string.rstrip)



模块字符串中函数rstrip的帮助:


rstrip(s,chars = None)

rstrip(s [, chars]) - >字符串


返回删除了尾随空格的字符串s的副本。

如果给出字符而不是None,则删除字符中的字符。

Jeremy Jones


Jeremy Jones< zanesdad< at> bellsouth.net>写道:

确保你已导入字符串。




无需导入字符串,你可以使用内置的str:

help(str.rstrip)
method_descriptor的帮助:


rstrip(...)

S.rstrip([chars]) - >字符串或unicode


返回字符串S的副本,删除尾部空格。

如果给出字符而不是None,则删除字符中的字符。

如果chars是unicode,S将在剥离之前转换为unicode

help(str.ljust)



关于method_descriptor的帮助:


ljust(...)

S.ljust(width [,fillchar]) - > string


返回S左对齐长度为一个字符串。填充是使用指定的填充字符完成的
(默认是空格)。

Steve


Helmut Jarausch写道:

进入
帮助(''rstrip'')

帮助(''ljust'')

>进入IDLE的shell窗口我只得到
没有找到Python文档...

我错过了什么?




你需要从参数中删除引号,即

help(rstrip)#help(''rstrip'')是一个no-no




我必须说这个错误信息真的很烦人。你不能猜测它出了什么问题。

乔治


Hi,

entering
help(''rstrip'')
or
help(''ljust'')

into IDLE''s shell window I only get
no Python documentation found ...

Am I missing something?

Thanks for a hint,
Helmut.

--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany

解决方案

Helmut Jarausch wrote:

Hi,

entering
help(''rstrip'')
or
help(''ljust'')

into IDLE''s shell window I only get
no Python documentation found ...

Am I missing something?

Thanks for a hint,
Helmut.



Make sure you''ve imported string. Then you can do:

help(string.rstrip)


Help on function rstrip in module string:

rstrip(s, chars=None)
rstrip(s [,chars]) -> string

Return a copy of the string s with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
Jeremy Jones


Jeremy Jones <zanesdad <at> bellsouth.net> writes:

Make sure you''ve imported string.



No need to import string, you can use the builtin str:

help(str.rstrip) Help on method_descriptor:

rstrip(...)
S.rstrip([chars]) -> string or unicode

Return a copy of the string S with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
If chars is unicode, S will be converted to unicode before stripping
help(str.ljust)


Help on method_descriptor:

ljust(...)
S.ljust(width[, fillchar]) -> string

Return S left justified in a string of length width. Padding is
done using the specified fill character (default is a space).
Steve


Helmut Jarausch wrote:

entering
help(''rstrip'')
or
help(''ljust'')

into IDLE''s shell window I only get
no Python documentation found ...

Am I missing something?



You need to remove quotes from arguments, i.e.,

help(rstrip) # help(''rstrip'') is a no-no



I have to say this error message is really annoying. You can''t
guess what went wrong from it.
George


这篇关于关于字符串函数的交互式帮助 - howto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆