Setzen Sie sich auf PythonPython

Python-Programme
Anonymous
 Setzen Sie sich auf Python

Post by Anonymous »

Gibt es eine pythonische Möglichkeit, einen Set in einen Diktat umzuwandeln?

Code: Select all

s = {1,2,4,5,6}
< /code>

und möchte das folgende Diktat < /p>

c = {1:0, 2:0, 3:0, 4:0, 5:0, 6:0}
< /code>

Mit einer Liste würden Sie < /p>

machena = [1,2,3,4,5,6]
b = []

while len(b) < len(a):
b.append(0)

c = dict(itertools.izip(a,b))

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post