wasm-demo/demo/ermis-f/python_m/cur/0651

50 lines
1.2 KiB
Plaintext

From: sweeting at neuronet.com.my (sweeting at neuronet.com.my)
Date: Sun, 25 Apr 1999 14:57:30 GMT
Subject: converting perl to python - simple questions.
Message-ID: <7fvagp$8lm$1@nnrp1.dejanews.com>
X-UID: 651
In my ongoing saga to build a chinese-language search engine, I've found a
great deal of groundwork already. The bad news (for me) is that this was all
in Perl so I've had a rather distressing day :
(a) learning perl
(b) converting the scripts to python so that I can build objects with them.
Anyway, since I know that there are a few ex-perlmongers on the list,
would somebody be so kind as to confirm whether I've translated the following
code snippets correctly :
a) Perl's "defined".
[perl]
if (defined($x{$token})
[python]
if (x.has_key(token) and x[token]!=None) :
b) RE's.
[perl]
if ($mytext !~ /^\s$/)
[python]
if not (re.match('^\s$'), mytext)
Since I know neither perl nor chinese, it would be nice if somebody
could help me remove one of the variables in my debugging.
Thanking you :)
chas
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own