Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92819889
ParameterList.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 23, 23:12
Size
774 B
Mime Type
text/x-python
Expires
Mon, Nov 25, 23:12 (1 d, 13 h)
Engine
blob
Format
Raw Data
Handle
22522376
Attached To
rGLUPS glups
ParameterList.py
View Options
import
string
class
ParametersList
(
dict
):
def
__init__
(
self
,
ID
=
None
):
self
.
ID
=
ID
def
Info
(
self
):
for
key
in
self
.
keys
():
print
"
%s
:
%s
=
%s
"
%
(
self
.
ID
,
key
,
str
(
self
[
key
]))
def
Write
(
self
,
f
):
keys
=
self
.
keys
()
keys
.
sort
()
for
key
in
keys
:
string
=
"
%s
:
%s
=
%s
\n
"
%
(
self
.
ID
,
key
,
str
(
self
[
key
]))
f
.
write
(
string
)
def
Read
(
self
,
f
,
ID
=
None
):
if
ID
==
None
:
ID
=
self
.
ID
f
.
seek
(
0
)
lines
=
f
.
readlines
()
f
.
seek
(
0
)
for
line
in
lines
:
Id
,
val
=
string
.
split
(
line
,
':'
)
if
Id
==
ID
:
val
=
string
.
strip
(
val
)
key
,
val
=
string
.
split
(
val
,
'='
)
key
=
string
.
strip
(
key
)
cmd
=
"""self["%s"] = %s"""
%
(
key
,
val
)
exec
(
cmd
)
Event Timeline
Log In to Comment