Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
source
OBSW MOD GENERATOR CORE
Commits
af383e7f
Unverified
Commit
af383e7f
authored
May 17, 2021
by
Robin Mueller
Browse files
smaller tweaks
parent
bf38f952
Changes
1
Hide whitespace changes
Inline
Side-by-side
utility/csv_writer.py
View file @
af383e7f
...
...
@@ -27,13 +27,13 @@ class CsvWriter:
self
.
table_to_print
=
table_to_print
self
.
header_array
=
header_array
if
self
.
header_array
!=
0
:
self
.
column
N
umbers
=
len
(
self
.
header_array
)
self
.
column
_n
umbers
=
len
(
self
.
header_array
)
self
.
file_separator
=
file_separator
def
write_to_csv
(
self
):
file
=
open
(
self
.
filename
,
"w"
)
file
.
write
(
"Index"
+
self
.
file_separator
)
for
index
in
range
(
self
.
column
N
umbers
):
for
index
in
range
(
self
.
column
_n
umbers
):
# noinspection PyTypeChecker
if
index
<
len
(
self
.
header_array
)
-
1
:
file
.
write
(
self
.
header_array
[
index
]
+
self
.
file_separator
)
...
...
@@ -41,7 +41,7 @@ class CsvWriter:
file
.
write
(
self
.
header_array
[
index
]
+
"
\n
"
)
for
index
,
entry
in
self
.
table_to_print
.
items
():
file
.
write
(
str
(
index
)
+
self
.
file_separator
)
for
columnIndex
in
range
(
self
.
column
N
umbers
):
for
columnIndex
in
range
(
self
.
column
_n
umbers
):
# noinspection PyTypeChecker
if
columnIndex
<
len
(
self
.
header_array
)
-
1
:
file
.
write
(
str
(
entry
[
columnIndex
])
+
self
.
file_separator
)
...
...
@@ -53,9 +53,9 @@ class CsvWriter:
copy_file
(
self
.
filename
,
copy_destination
)
print
(
"CSV file was copied to "
+
copy_destination
)
def
move_csv
(
self
,
move_destination
):
def
move_csv
(
self
,
move_destination
:
str
):
move_file
(
self
.
filename
,
move_destination
)
if
move_destination
==
".."
or
move_destination
==
"../"
:
print
(
"CSV Writer: CSV file was moved to parser root directory"
)
else
:
print
(
"CSV Writer: CSV file was moved to
"
+
move_destination
)
print
(
f
"CSV Writer: CSV file was moved to
{
move_destination
}
"
)
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