Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Merge requests
!7
Main
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Main
bav1758/ci-s-projekt-verarbeitung:main
into
main
Overview
0
Commits
22
Pipelines
0
Changes
1
Merged
Große, Judith
requested to merge
bav1758/ci-s-projekt-verarbeitung:main
into
main
3 years ago
Overview
0
Commits
22
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
ee25e3df
Prev
Next
Show latest version
1 file
+
27
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
ee25e3df
Demo um Datei für den Output zu erstellen
· ee25e3df
Große, Judith
authored
3 years ago
verarbeitung/json_demo.py
0 → 100644
+
27
−
0
Options
#!/usr/bin/env python3
import
json
def
output_to_json
(
V
,
E
):
list_of_node_dicts
=
list
()
list_of_edge_dicts
=
list
()
dict_of_all
=
dict
()
for
node
in
V
:
new_dict
=
dict
()
new_dict
[
"
doi
"
]
=
node
list_of_node_dicts
.
append
(
new_dict
)
for
edge
in
E
:
new_dict_2
=
dict
()
new_dict_2
[
"
source
"
]
=
edge
[
0
]
new_dict_2
[
"
target
"
]
=
edge
[
1
]
list_of_edge_dicts
.
append
(
new_dict_2
)
dict_of_all
[
"
nodes
"
]
=
list_of_node_dicts
dict_of_all
[
"
links
"
]
=
list_of_edge_dicts
return
(
dict_of_all
)
with
open
(
'
json_text_json
'
,
'
w
'
)
as
outfile
:
json_dump
(
dict_of_all
,
outfile
)
knoten
=
[
"
doi1
"
,
"
doi2
"
,
"
doi3
"
]
kanten
=
[[
1
,
2
],[
3
,
4
],[
5
,
6
]]
output_to_json
(
knoten
,
kanten
)
Loading