I have this function.
def write_file(tmpdir, filename):
full_file_name = tmpdir/filename
with openFile(filename) as p:
lines = p.readlines()
return lines
I have pass my filename. For example file.txt,and there can be written everything. How can I print out all of the lines of the file.txt file in this write_file function?
Generic syntax to print the file lines
with open(your_file, 'r') as f:
print(''.join([for x in f.readlines()]))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.