commited all contents created by participants
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
|
||||
#!/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))
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/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)
|
||||
|
||||
new_letter = []
|
||||
|
||||
words = sentence.split()
|
||||
|
||||
# for each word
|
||||
for word in words:
|
||||
# iterate over letters of word
|
||||
for letter in word:
|
||||
new_letter.append(letter)
|
||||
|
||||
#print(new_letter)
|
||||
print("phrase sans espaces:", "".join(new_letter))
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/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)
|
||||
|
||||
new_letter = []
|
||||
|
||||
words = sentence.split()
|
||||
|
||||
# for each word
|
||||
for word in words:
|
||||
# iterate over letters of word
|
||||
for letter in word:
|
||||
new_letter.append(letter)
|
||||
|
||||
#print(new_letter)
|
||||
print("phrase sans espaces:", "".join(new_letter))
|
||||
|
||||
#for letter in new_letter:
|
||||
# new_letter = letter.sort(" ")
|
||||
new_letter.sort()
|
||||
#print(new_letter)
|
||||
|
||||
print("suite de lettres", "".join(new_letter))
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#importer expr. regulières
|
||||
import re
|
||||
|
||||
#ouvrir le texte source
|
||||
myfile = open("Le_tour_du_monde_en_quatre-vingts_jours_francais.txt", "r")
|
||||
texte = myfile.read()
|
||||
myfile.close()
|
||||
# print(texte)
|
||||
|
||||
#garder le paratexte (intro)
|
||||
intro_match = re.search(r'-intro-(.*)-intro-',texte,re.DOTALL)
|
||||
intro = intro_match[1]
|
||||
#print(intro)
|
||||
|
||||
texte.replace(intro_match[0], '');
|
||||
|
||||
#définir la liste de lettres
|
||||
new_letter = []
|
||||
|
||||
#séparer le texte en mots
|
||||
words = texte.split()
|
||||
#print(words)
|
||||
# pour chaque mot
|
||||
for word in words:
|
||||
#pour chaque lettre
|
||||
for letter in word:
|
||||
#écrire une liste de lettres
|
||||
new_letter.append(letter)
|
||||
|
||||
#print(new_letter)
|
||||
#print("texte sans espaces:", "".join(new_letter))
|
||||
"".join(new_letter)
|
||||
|
||||
#ranger les lettres dans l'ordre alphabétique
|
||||
new_letter.sort()
|
||||
#print(new_letter)
|
||||
|
||||
#joindre les lettres avec rien et ajouter l'intro
|
||||
print("".join(new_letter), intro)
|
||||
|
||||
#exporter dans un fichier texte
|
||||
with open('export.txt', 'w') as f:
|
||||
f.write("".join(new_letter) + intro)
|
||||
Reference in New Issue
Block a user