5 examples of 'python readlines strip' in Python

Every line of 'python readlines strip' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
280def readlines(self):
281 """Read and return the list of all logical lines remaining in the
282 current file."""
284 lines = []
285 while True:
286 line = self.readline()
287 if line is None:
288 return lines
289 lines.append(line)
1033def readlines(filename):
1034 f = open(filename)
1035 try:
1036 return f.readlines()
1037 finally:
1038 f.close()
42def readLines(in_file):
43 """Returns a list of lines from a input markdown file."""
45 with open(in_file, 'r') as inf:
46 in_contents = inf.read().split('\n')
47 return in_contents
11def read_input(file):
12 for line in file:
13 yield line.rstrip()
42def read_line(filename):
43 """help function to read a single line from a file. returns none"""
44 try:
45 f = open(filename)
46 line = f.readline().strip()
47 f.close()
48 return line
49 except IOError:
50 return None

Related snippets