Reputation: 9
I have these variables
m1 = 'ZZZZZ'
m2 = 'Z___Z'
m3 = 'ZZZZZ'
that represent a maze. When I print these strings out, I want it to ignore the underscores and replace them with spaces. How can I achieve this?
Upvotes: 0
Views: 123
Reputation: 19242
You can use .replace()
:
For example,
'Z___Z'.replace('_', ' ')
will output:
Z Z
Upvotes: 2