Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
python-uga
py-training-2017
Commits
23a27844
Commit
23a27844
authored
Dec 13, 2021
by
Mathieu Istas
Browse files
corrected file path in TP0
parent
eb352627
Pipeline
#83809
passed with stage
in 54 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ipynb/pres04_readwritefiles.ipynb
View file @
23a27844
...
...
@@ -123,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count":
3
,
"execution_count":
7
,
"metadata": {},
"outputs": [
{
...
...
@@ -297,9 +297,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
7.3
"
"version": "3.
8.10
"
}
},
"nbformat": 4,
"nbformat_minor":
2
"nbformat_minor":
4
}
ipynb/pres05_practical0.ipynb
View file @
23a27844
...
...
@@ -47,13 +47,14 @@
-
update the current statistics.
### Example of output
```
bash
python3 step0.0.py
file
=
"../data/file0.1.txt"
# on Windows:
python3 step0.0.py
path_to_data
=
'../TP/TP0_file_stats/data/'
file
=
path_to_data +
"file0.1.txt"
# on Windows, replace '/' by '\':
# file = r"..\data\file0.1.txt"
# r like "raw" = no interpretation of the special characters ("\n", "\t", etc.)
# Such r-strings are also useful when we write Latex code in Python.
nb
=
78
;
sum
=
42.46
;
avg
=
0.54
```
...
...
@@ -88,16 +89,18 @@
Same as step 0.1 but process many files and print file base statistics and overall statistics:
```
bash
python3 step0.2.py
file
=
"../data/file0.1.txt"
python3 step0.2.py
path_to_data
=
'../TP/TP0_file_stats/data/'
file
=
path_to_data +
"file0.1.txt"
nb
=
78
;
sum
=
42.46
;
avg
=
1.84
file
=
"../data/
file0.2.txt"
file
=
path_to_data +
"
file0.2.txt"
nb
=
100
;
sum
=
53.29
;
avg
=
0.53
file
=
"../data/
file0.3.txt"
file
=
path_to_data +
"
file0.3.txt"
nb
=
25
;
sum
=
12.72
;
avg
=
0.51
# total over all files:
nb
=
203
;
sum
=
108.47
;
avg
=
0.53
```
...
...
@@ -113,11 +116,11 @@
Possible result:
```
bash
python3 step1.0.py
file
=
../data/file_with_comment_col0.txt
file
=
../
TP/TP0_file_stats/
data/file_with_comment_col0.txt
nb
=
100
;
total
=
53.29
;
avg
=
0.53
```
%% Cell type:markdown id: tags:
...
...
@@ -133,14 +136,16 @@
Adapt script 1.0 to handle this format.
Possible output:
```
bash
python3 step1.1.py
file
=
"../data/file_with_comment_col0.txt"
python3 step1.1.py
path_to_data
=
'../TP/TP0_file_stats/data/'
file
=
path_to_data +
"file_with_comment_col0.txt"
nb
=
100
;
sum
=
53.29
;
avg
=
0.53
file
=
"../data/
file_with_comment_anywhere.txt"
file
=
path_to_data +
"
file_with_comment_anywhere.txt"
nb
=
96
;
sum
=
51.65
;
avg
=
0.54
# total over all files:
nb
=
196
;
sum
=
104.93
;
avg
=
0.54
```
...
...
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