开发者

How to read log files in python in django

开发者 https://www.devze.com 2023-03-08 13:42 出处:网络
I am trying to read the log files or any other file and display in web browser using django and python

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消