i return something like this from function:
def f():
d = dict()
# fill dict
d["s"]
return (1, d)
then:
ret = f()
d = ret[1]
print (d["s"])
on print line i get "sequence is not an int, slice or ... __index__"
please help!
Is this really the code you run to get the error you mentioned?
On line 4 in f() you do not assign a value to the key "s", which gives an error when I run your code.
(Feb-26-2018, 08:01 AM)j.crater Wrote: [ -> ]Is this really the code you run to get the error you mentioned? On line 4 in f() you do not assign a value to the key "s", which gives an error when I run your code.
sorry, i do assign a value.
If I modify the code so that it assigns a value, it works for me. You may want to be more specific about the code and error you get.
oh. this is weird. now it works for me too. i haven't changed anything...
(Feb-26-2018, 12:47 PM)buran Wrote: [ -> ] (Feb-26-2018, 10:10 AM)bb8 Wrote: [ -> ]oh. this is weird. now it works for me too. i haven't changed anything...
That is a miracle...
people usually say this about c++ but in thia case:
that is python...