Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Rapid Prototyping Lab
Python Modules
info-beamer tools
Commits
66903d61
Commit
66903d61
authored
Mar 01, 2019
by
Christian Lölkes
Browse files
added method to write JSON files
parent
0d836508
Changes
2
Hide whitespace changes
Inline
Side-by-side
ibtoolbox/__init__.py
View file @
66903d61
import
pytz
import
json
from
datetime
import
datetime
class
Toolbox
():
TIMEZONE
=
pytz
.
timezone
(
'Europe/Berlin'
)
@
staticmethod
def
write_JSON
(
content
,
target
=
'content.json'
):
with
open
(
target
,
'w'
)
as
outfile
:
outfile
.
write
(
json
.
dumps
(
content
,
ensure_ascii
=
False
).
encode
(
'utf8'
))
outfile
.
close
()
@
staticmethod
def
utc_time
():
now
=
datetime
.
utcnow
()
...
...
ibtoolbox/__main__.py
View file @
66903d61
from
ibtoolbox
import
*
if
__name__
==
'__main__'
:
print
(
Toolbox
.
local_formatted_time
())
print
(
Toolbox
.
local_formatted_date
())
print
(
Toolbox
.
local_formatted_long_date
())
print
(
Toolbox
.
week_number
())
print
(
Toolbox
.
local_full_formatted_date
())
pass
Write
Preview
Supports
Markdown
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