hi!
i want to replace these characters:
- sex_m-designer_bw-size_42
so that i have the argument string:
- sex=m&designer=bw&size=42
i am working under zope 3.
glad for any help you can give me (i am veryyyy new in python, so please speak slow).
thank you,
steven, vienna
Here, again, the replace() method of a string object will do the job nicely:
-
>>> s = "sex_m-designer_bw-size_42"
-
>>> s = s.replace('_', '=')
-
>>> s = s.replace('-', '&')
-
>>> s
-
'sex=m&designer=bw&size=42'
-
>>>
Here, I have used Python's interactive interpreter (denoted by the '>>>' prompt) to run off a quick test of the idea. In interactive mode, all of the built-in types (most of which are true objects in the OOP sense of the term) and functions are available.
Hope I spoke slowly enough,
Barton