Getting two characters from string in python

Posted by Adomas on Stack Overflow See other posts from Stack Overflow or by Adomas
Published on 2010-05-22T13:38:19Z Indexed on 2010/05/22 13:40 UTC
Read the original article Hit count: 195

Filed under:
|
|
|

hi,

how to get in python from string not one character, but two?

I have:

long_str = 'abcd'
for c in long_str:
   print c

and it gives me like

a
b
c
d

but i need to get

ab
cd

I'm new in python.. is there any way?

© Stack Overflow or respective owner

Related posts about python

Related posts about loops