MICHÁLEK Jan Mgr. napsal(a), dne 9.6.2009 19:52:

>>takto?: print '%s,%s,%s' % ('a','b','c','d','e','f')[2:5]

nene, potřebuju vybrat řekněme první tři a šestej znak

tj. ('a','b','c','f')


počet "%s" je tři, tudíž řekněme že potřebuješ první dva a poslední:

trojice= ('a','b','c','d','e','f')[0:2]+tuple(('a','b','c','d','e','f')[5])
# protoze ciste ('a','b','c','d','e','f')[5] vraci "f" a ne ("f")
print '%s,%s,%s' % trojice



--
geon
Pavel Kosina

_______________________________________________
Python mailing list
Python@py.cz
http://www.py.cz/mailman/listinfo/python

Odpovedet emailem