string array

O

Oziris Moreira

I would like to know how I can put a word into an array character by
character, for example the user type the word "hello" and the array
would be ["h","e","l","l","o"], I only know how to this with gets but I
don't want to press enter after every character.

thanks in advance
 
G

Giampiero Zanchi

Oziris said:
I would like to know how I can put a word into an array character by
character, for example the user type the word "hello" and the array
would be ["h","e","l","l","o"], I only know how to this with gets but I
don't want to press enter after every character.

thanks in advance

s = 'hello'
s_array = s.split('')
 
O

Oziris Moreira

Giampiero said:
Oziris said:
I would like to know how I can put a word into an array character by
character, for example the user type the word "hello" and the array
would be ["h","e","l","l","o"], I only know how to this with gets but I
don't want to press enter after every character.

thanks in advance

s = 'hello'
s_array = s.split('')

thank you very much !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top