在文件中搜索某些单词......很奇怪

时间:2017-09-21 15:13:59

标签: python python-3.x

我真的不知道发生了什么事。我抬头(在我的搜索栏中)“嗨”,它说2找到的结果,如果我查找任何其他字体它只是给我500错误。任何人吗?

#! /usr/bin/python

import cgi

data = cgi.FieldStorage()

searchHome = data.getvalue( 'search' )
result = "There was 0 results for search " + searchHome
total = 0
total = int(total)
with open('index.py') as f:
    for line in f:
        finded = line.find(searchHome)
        if finded != -1 and finded != 0:
            total += 1
            total = str(total)
            result = "There was " + total + " result(s) for search term: " + searchHome


print 'Content-type: text/html\n\r\n\r'
print result

感谢您的帮助,Reefive / Sky Coleman。编辑:修改代码:D

更多编辑: 好的,错误,我找不到,我浏览了所有的cPanel文件,等等,查看了帮助等等,当我查找“Hi”以外的任何内容时,它只给我一个500错误。

0 个答案:

没有答案