katılmak (2,3 | 5,6 | 8,9), ancak iadeler benim işlevi boş bir dizePython liste yineleme ve ben şöyle bir dize döndüren bir işlev yazmaya çalışıyorum
numbers = [(4,5,6),(1,2,3),(7,8,9)]
def get_numbers(x):
mystring = ""
x = sorted(x)
for n in x:
if mystring is not "":
mystring+="|"
mystring+",".join(str(z) for z in n[1:])
return mystring
Bunu nasıl düzeltebilirim?
Nasıl elde edilir? [(4,5,6), (1,2,3), (7,8,9)] 'dan '' (2,3 | 5,6 | 8,9) ''? – timgeb
Bu yüzden, [1:] 'ın hile ile tahmin ediyorum – th3an0maly