Newbie - Stuck
Christoph Haas
email at christoph-haas.de
Mon Oct 9 15:24:09 EDT 2006
On Sunday 08 October 2006 14:09, r3bol at yahoo.com 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
More information about the Python-list
mailing list