Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
a6a8e0f601822270ca754f29f77749b6
mooc-rr
Commits
b5fb2a60
Commit
b5fb2a60
authored
Sep 23, 2020
by
a6a8e0f601822270ca754f29f77749b6
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Première partie de l'exercice.
parent
d21a887b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
3 deletions
+48
-3
exercice.ipynb
module2/exo4/exercice.ipynb
+48
-3
No files found.
module2/exo4/exercice.ipynb
View file @
b5fb2a60
{
"cells": [],
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyse des mots-clés de mon journal"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Mise en forme de mon journal\n",
"Mes paragraphes sont titrés \"Date:JJ/MM/AAAA\".\n",
"\n",
"La première ligne du paragraphe contient [Mots Clés:Xxxx,Yyyy,Zzzz] où Xxxx, Yyyy, Zzzz sont des mots-clés."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Recupération des données"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"NomFichentree = \"work/Journal/Readme_Journal.md\"\n",
"NomFichsortie = \"work/module2/exo4/Info_Journal.csv\"\n",
"\n",
"with open(NomFichsortie, \"w\", encoding='utf-8') as sortie:\n",
" with open(NomFichentree, \"r\", encoding='utf-8') as entree:\n",
" for ligne in entree:\n",
" if \"Date:\" in ligne:\n",
" (rien,date) = ligne.lstrip('## ').strip().split(':')\n",
" if \"Mots Clés\" in ligne:\n",
" (rien,mots) = ligne.strip('Mots Clés').split(':')\n",
" listemots = mots.strip().split(',')\n",
" for mot in listemots:\n",
" sortie.write(f\"{date};{mot}\\n\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
...
...
@@ -16,10 +62,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.
3
"
"version": "3.6.
4
"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment