On Fri, Feb 6, 2009 at 6:54 AM, Kent Johnson wrote:
> 2009/2/6 jitendra gupta :
>
> > Try this if u r looking for this kind of solution
> my_input = "one two three four five six seven eight nine ten"
> text = my_input.split()
> for i in range(len(text)):
> >if i+3>=len(text):
2009/2/6 jitendra gupta :
> Try this if u r looking for this kind of solution
my_input = "one two three four five six seven eight nine ten"
text = my_input.split()
for i in range(len(text)):
>if i+3>=len(text):
>print text[i-3:len(text):1]
>elif i<=2:
>
Le Fri, 6 Feb 2009 12:30:31 +0530,
jitendra gupta a écrit :
> > #BEGIN
> > my_input = "one two three four five six seven eight nine ten"
> > text = my_input.split()
> > for i,v in enumerate(text):
> > line = text[i-3], text[i-2], text[i-1], v, text[i+1], text[i+2],
> > text[i+3]
> > prin
On Fri, Feb 6, 2009 at 5:43 AM, Emad Nawfal (عماد نوفل)
wrote:
> Hi Tutors,
> I'm a little, actually a lot confused by the behavior of the enumerate
> function here. I have a text and I want to get each word within the context
> of the three preceding and the three following words. I tried this:
"Emad Nawfal (عماد نوفل)" wrote
I'm a little, actually a lot confused by the behavior of the
enumerate
Its not enumerate thats confusing you its indexing.
my_input = "one two three four five six seven eight nine ten"
text = my_input.split()
for i,v in enumerate(text):
line = text[i-3],
Hi Tutors,
I'm a little, actually a lot confused by the behavior of the enumerate
function here. I have a text and I want to get each word within the context
of the three preceding and the three following words. I tried this:
#BEGIN
my_input = "one two three four five six seven eight nine ten"
tex