Hi,
I have a slicing question that boils down to this:
The number (2nd argument) indicates how many letters I want from the name.
Ususally this is going to be 1 : the initial, in this case "J", position 0.
But what (number) should I pass when I want the whole name, so no slicing?
If that is not possible, of course an if 0: do this, else: do the whole name, is a workaround.
I can also calculate the length of the string and do an [x:y] slice.
But maybe there is a simpler solution?
thanks,
Paul
I have a slicing question that boils down to this:
1 2 3 4 |
def printslice(fname,x): print (fname[x]) printslice( 'Jeremy' , 0 ) |
Ususally this is going to be 1 : the initial, in this case "J", position 0.
But what (number) should I pass when I want the whole name, so no slicing?
If that is not possible, of course an if 0: do this, else: do the whole name, is a workaround.
I can also calculate the length of the string and do an [x:y] slice.
But maybe there is a simpler solution?
thanks,
Paul