从本周的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'