[Tutor] error message
Michael Emperador
memperad@iaware.org
Fri, 20 Jul 2001 12:11:26 -0700 (PDT)
I get the following error message when running the script below. I am
using python 2.0 on Suse 7.2.
Error:
Traceback (most recent call last):
File "./test.py", line 20, in ?
curr_cust(customers, name)
File "./test.py", line 8, in curr_cust
if x in ("seq2"):
TypeError: 'in <string>' requires character as left operand
Script:
#! /usr/bin/python
import cgi, os, string
def curr_cust(seq1,seq2):
cust = []
for x in seq1:
if x in ("seq2"):
cust.append(x)
return cust
file = open('/usr/local/httpd/htdocs/pp/opt/customers','r')
customers = file.readlines()
file.close()
form = {'username':'Somers'}
name = form['username']
curr_cust(customers, name)
Mike