Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Oceano2python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
Oceano2python
Commits
bb91a5b7
Commit
bb91a5b7
authored
6 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
use indMax and format
parent
1be78263
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
file_extractor.py
+8
-1
8 additions, 1 deletion
file_extractor.py
with
8 additions
and
1 deletion
file_extractor.py
+
8
−
1
View file @
bb91a5b7
...
...
@@ -3,6 +3,7 @@ file_extractor.py
'''
import
fileinput
import
toml
import
numpy
class
FileExtractor
:
...
...
@@ -19,6 +20,7 @@ class FileExtractor:
# private:
self
.
__headeer
=
{}
self
.
__data
=
{}
self
.
__indMax
=
0
# constructor build objet by reading the file
# overloading operators
...
...
@@ -29,17 +31,22 @@ class FileExtractor:
# read code roscop file
def
read
(
self
,
keys
,
dic
):
indice
=
0
for
line
in
fileinput
.
input
(
self
.
file
,
openhook
=
fileinput
.
hook_encoded
(
"
ISO-8859-1
"
)):
if
line
[
0
]
==
'
#
'
or
line
[
0
]
==
'
*
'
:
continue
indice
+=
1
# iterate over the lines of opened file "fileName"
# ------------------------------------------------
p
=
line
.
split
()
for
k
in
keys
:
print
(
"
{}
"
.
format
(
p
[
dic
[
k
]]),
end
=
''
)
print
(
'
{:>{width}}
'
.
format
(
p
[
dic
[
k
]],
width
=
8
),
end
=
'
'
)
print
()
self
.
__indMax
=
indice
print
(
"
{}
"
.
format
(
self
.
__indMax
))
# for testing in standalone context
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment