On 16/04/13 22:20, Andy McKenzie wrote:
For instance: output of running print_r on a very short dictionary from
PHP:
Array
(
[key3] => thing3
[key2] => thing2
[key1] => thing1
)
And running pprint on the same dict in Python:
{'key1': 'thing1', 'key2': 'thing2', 'key3': 'thing3'}
I finally decided that a good project would be building a quick function
that recreates the print_r function, and I got that working. New
function output, in Python:
(
[key3] => thing3
[key2] => thing2
[key1] => thing1
)
You should probably use {} instead of () as the delimiter to indicate
that the thing is a dictionary and not a tuple. but otherwise that's a
good starter project.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor