I tried
Expand|Select|Wrap|Line Numbers
- s=[1,2,3,4]
- for i in s:
- str(a[i])
- '2'
- '3'
- '4'
Expand|Select|Wrap|Line Numbers
- str(a[i-1])
My second question is about create a new string
Expand|Select|Wrap|Line Numbers
- # I have a string
- s='hello! world'
- # now I want to have a new string printed as
- #h
- #he
- #hel
- #...
- # I tried
- for i in len(s):
- stringA=a[i]
- stringA+=a[i+1]
- print stringA
- #but it did not work