File: test_readlines.py

package info (click to toggle)
imediff 3.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 820 kB
  • sloc: python: 6,397; sh: 904; xml: 336; makefile: 28
file content (19 lines) | stat: -rw-r--r-- 586 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python3
# vim:se tw=79 sts=4 ts=4 et ai fileencoding=utf-8 :
fp = open("report.py", "r")
line_list = fp.readlines()
#
# list of string containing \n at the end of each item
# for line in range(len(line_list)):
for line in line_list:
    print("line='{}'".format(line))

bigline = "".join(line_list)
print("================================================")
print(bigline)
print("================================================")

FOOLINE = "a\nb\nc\n"
print(FOOLINE.split())
print("================================================")
print(FOOLINE.splitlines(keepends=True))