How to read log files in python in django
I am trying to read the log files or any other file and display in web browser using django and python
I used this code
data_file = open('/var/log/samba', 'r') # note开发者_StackOverflow中文版 -- 'r' not r
data = data_file.readlines() # returns a list of lines
I get this error
[Errno 21] Is a directory: '/var/log/samba'
You're trying to open a directory. Don't do that. Open a file instead.
精彩评论