Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.python > #3529

Création d'une boucle qui sépare en fichiers à la rencontré du mot chapitre

Path csiph.com!eternal-september.org!reader02.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Tue, 18 May 2021 09:00:16 -0500
Newsgroups fr.comp.lang.python
Subject Création d'une boucle qui sépare en fichiers à la rencontré du mot chapitre
X-poster PEAR::Net_NNTP v1.5.0 (stable)
From JiminyCricket <nospam_corinne.a@neuf.fr.invalid>
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Organization !No_Organization!
Message-ID <mISdnZVsHKntVT79nZ2dnUU7983NnZ2d@giganews.com> (permalink)
Date Tue, 18 May 2021 09:00:16 -0500
Lines 16
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-WMrQYVq7v+a6HCWjWmbk+mWZoGfjvqKQFC9JV/7af9EbRJaZD5qRCg6QlKUDeZLQxDiLxhyK2eVMQ+G!u/yqIuhsSSIF9/q8sdglrsxpQIzis7rVss921HRgN974/XX5z0w/hh9SxEGSxOm1aOnF537wXp4F
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Lines 13
X-Original-Bytes 1662
Xref csiph.com fr.comp.lang.python:3529

Show key headers only | View raw


Bonjour à tous,

Je souhaiterais faire une boucle qui créé un nouveau fichier quand elle
rencontre les mots 'chapitre' et 'épilogue'. Cela me ferait en tout 136
chapitres nommés chapitre_1.txt [...] épilogue. txt
J'ai essayé la boucle

For i in ligne:
if 'CHAPTER' :
print('chapitre_. txt')
elif 'Epilogue'
print('épilogue. txt')

mais le terminal me donne le texte entier et 135 lignes chapitre_. txt sans pour
autant me créer de nouveaux fichiers et l'épilogue n'apparaît pas. Je suis
perdue. Est-ce que quelqu'un pourrait m'aider s'il vous plaît ?
Merci d'avance pour vos réponses

Back to fr.comp.lang.python | Previous | NextNext in thread | Find similar


Thread

Création d'une boucle qui sépare en fichiers à la rencontré du mot chapitre JiminyCricket <nospam_corinne.a@neuf.fr.invalid> - 2021-05-18 09:00 -0500
  Re: Création d'une boucle qui sépare en fichiers à la rencontré du mot chapitre Julien Palard <julien@palard.fr> - 2021-05-18 17:49 +0200

csiph-web