print 1 word of string in python

From thelinuxwiki
Revision as of 01:19, 31 May 2024 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

mystring = 'cheetahs run real fast'

print mystring.split()[2]

real

the [index] starts at zero