forked from easyawslearn/Python-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextwrap-example.py
More file actions
24 lines (17 loc) · 832 Bytes
/
textwrap-example.py
File metadata and controls
24 lines (17 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import textwrap
example="""This function wraps the input paragraph such that each line
in the paragraph is at most width characters long. The wrap method
returns a list of output lines."""
print("An example of text wrapping with 70 characters in line\n")
print (textwrap.fill(example,70))
print("\nAn example of text wrapping with 30 characters in line\n")
print (textwrap.fill(example,10))
print("\nAn example of text wrapping with 40 characters with start with *\n")
print (textwrap.fill(example,40,initial_indent='*'))
print("\nAn example of text wrapping with 40 characters with start with *\n")
print (textwrap.fill(example,40,subsequent_indent='*'))
example2=""" 1
2
3 """
print("\nAn example of text wrapping dedent\n")
print (textwrap.dedent(example2))