On Sunday 08 October 2006 14:09, [EMAIL PROTECTED] wrote:
> The perl version of this code works but not the python version. What am
> I doing wrong?
>
> message = "abc"
> password = "z12"
>
> scrambled = message ^ password

"abc" XOR "z12"? Strings don't have an __xor__ method.

> I also wondered why this errored as well...
>
> int(messege)
>
> Is it not meant to convert a string to a number?

If you were Python how would you convert "abc" to a number? :)

Yes, I know Perl makes "0" from anything that doesn't look like a number 
but Python's principle is to never hide errors while Perl makes certain 
assumptions. So Python prefers to complain.

 Christoph
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to