开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜