Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UCC
UCC Snack Machine Server Code
Commits
87f1523d
Commit
87f1523d
authored
Apr 06, 2015
by
Mark Tearle
Browse files
Alter display code to pad with spaces and simplify
parent
4fa88583
Changes
1
Hide whitespace changes
Inline
Side-by-side
VendServer/VendingMachine.py
View file @
87f1523d
...
...
@@ -160,9 +160,9 @@ class VendingMachine:
return
(
code
==
'501'
,
code
,
string
)
def
display
(
self
,
string
):
if
len
(
string
)
>
10
:
string
=
string
[
0
:
10
]
self
.
wfh
.
write
(
'D'
+
string
+
'
\n
'
)
# display first ten characters of string, left aligned
self
.
wfh
.
write
(
'D%-10.10s
\n
'
%
string
)
(
code
,
string
)
=
self
.
get_response
()
return
(
code
==
'300'
,
code
,
string
)
...
...
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