I'm tryng to read sentence for sentence from an input with python:

sentences = raw_input("Insert some sentences here: ")

(For example: Hello, my name is Mattia)

How i can read sentence for sentence?
For example:
1 = "Hello"
2 = ","
3 = "my"
4 = "name"
5 = "is"
6 = "Mattia"

Here is the most basic approach ...

sentence = "Hello, my name is Mattia"

# default split is at whitespace
for word in sentence.split():
    print(word)

''' result ...
Hello,
my
name
is
Mattia
'''

I leave it to you to separate the comma from Hello.

You could also make it slowly print each string one by one as fast or as slowly as you want doing this program.

from time import sleep

def foo():
    print "Hello"
    sleep(.5)
    print "my"
    sleep(.5)
    print "name"
    sleep(.5)
    print "is"
    sleep(.5)
    print "Matia"
    sleep(.5)
    print "..."
    sleep(.5)

foo()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.