Files
ola5doc/output/sources/phrase_sans_espaces1.py
T

37 lines
820 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Write sentence as string
sentence = "Je vois La Vie en rose... Tu vois Le Ciel en vert!"
# Print sentence
print("phrase originale:", sentence)
# Convert sentence in one word (remove spaces)
#one_word = sentence.strip(" ")
#print("sans les espaces:", one_word)
# define new word as list
new_word = []
# Convert sentence in list of words
words = sentence.split()
#print(words)
# For each word in word list
for word in words:
# remove capital letters (string operation)
#word = word.lower()
# Clean punctuation (string operation)
#word = word.strip(" ;''?:,()!.\").”-")
# add word to new word list
new_word.append(word)
#new_letter = []
#letter = words.split()
#print(letter)
# Write words as one, without spaces
print("phrase sans espaces:", "".join(new_word))