Il metodo split() è un metodo di stringa. Per sapere quello che fa usa help:
Se non capisci capisci quello che ti dice help usa l'interprete per sperimentare:codice:>>> help(''.split) Help on built-in function split: split(...) S.split([sep [,maxsplit]]) -> list of strings Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator. >>>
codice:>>> "123456".split("123") ['', '456'] >>> "123|456".split("|") ['123', '456'] >>> "123hey456".split("hey") ['123', '456']No. Ma non fai prima a provare tu stesso?se ad esempio da tastiera digito:
cane ha 5 anni
viene cosi??:
lista = split(raw_input("Dammi i tre numeri"))
e gli oggetti saranno:
cane, ha, 5,anni ??????
Inoltre questi sono concetti davvero basilari.
Se ti leggi un tutorial per noob dall'inizio alla fine prima di mettere mano al codice questi problemi li risolvi tu stesso.

Rispondi quotando