[Tutor] Question regarding character conversion usage.

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Aug 19 09:02:42 CEST 2004


> def AsciiToEbcdic(str):
>     '''Return the ASCII string str in EBCDIC form.
>     '''
>
> def EbcdicToAscii(str):
>
> def Test():
>     str = "The dog jumped over the lazy brown fox in 1.234567890
seconds"
>     str1 = EbcdicToAscii(AsciiToEbcdic(str))
>     if str != str1:
>         raise "Test failed"

What do you not understand exactly?

He provides two functions, each converting from one
string format to the other.

The test function demonstrates how to use them.
It creates an ASCII string (str), converts it to EBDIC and
back again, then checks that the result is the same as the
original. What bit of that do you not understand?

Alan G.
"Out of Sight, Out of mind" -> "Invisible, Lunatic"



More information about the Tutor mailing list