Я работаю на уступки Python, который требует текст, который будет ограничен, сортируют и печатается как:вложен цикл для spliting строки на основе нескольких разделителей
- предложения разделяются
.
- фраз,
,
- затем распечатаны
Что я сделал до сих пор:
text = "what time of the day is it. i'm heading out to the ball park, with the kids, on this nice evening. are you willing to join me, on the walk to the park, tonight."
for i, phrase in enumerate(text.split(',')):
print('phrase #%d: %s' % (i+1,phrase)):
phrase #1: what time of the day is it. i'm heading out to the ball park
phrase #2: with the kids
phrase #3: on this nice evening. are you willing to join me
phrase #4: on the walk to the park
phrase #5: tonight.
Я знаю, вложенным для нужен цикл и попытался с:
for s, sentence in enumerate(text.split('.')):
for p, phrase in enumerate(text.split(',')):
print('sentence #%d:','phrase #%d: %s' %(s+1,p+1,len(sentence),phrase))
TypeError: not all arguments converted during string formatting
намек и/или простой пример будет приветствоваться.
Собственное местоимение «Я» написано «Я». Пожалуйста, используйте «Я», когда обращаешься к себе. Всегда. –