Answer the question
In order to leave comments, you need to log in
How to deserialize a string in Python?
You need to deserialize a string like this in Python
a:16:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"4";i:4;s:1:"5";i:5;s:1:"6";i:6;s:1:"8";i:7;s:1:"9";i:8;s:2:"11";i:9;s:2:"12";i:10;s:2:"13";i:11;s:2:"14";i:12;s:2:"15";i:13;s:2:"16";i:14;s:2:"17";i:15;s:2:"18";}
unserialize($str)
from phpserialize import serialize, unserialize
@widgets.position('user_menu', order=1)
def user_menu():
... ... ...
rights = unserialize(perms)
return dict(rights=rights)
{% for r in rights %}
<li>
{{r}}
</li>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
<ul>
{% for key, value in rights.items %}
<li>{{key}} - {{value}}</li>
{% endfor %}
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question