python说模块'textwrap'没有属性'fill'

时间:2017-10-03 21:29:06

标签: python textwrapping

从本周的python 3模块中学习python中的一些模块。当我尝试模块textwrap

import textwrap

sample_text = '''
    The textwrap module can be used to format text for output in
    situations where pretty-printing is desired.  It offers
    programmatic functionality similar to the paragraph wrapping
    or filling features found in many text editors.
    '''

textwrap.fill(sample_text, width=70)

它说:module 'textwrap' has no attribute 'fill'

尝试

dedented_text = textwrap.dedent(sample_text)
print('Dedented:')
print(dedented_text)

它还说module 'textwrap' has no attribute 'dedent'

怎么来的?我使用的是python 3.6

0 个答案:

没有答案