Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
arjuvi
TIEP114
Commits
77948d9c
Commit
77948d9c
authored
Oct 29, 2021
by
arjuvi
Browse files
unohtui import re
parent
ac856798
Changes
1
Hide whitespace changes
Inline
Side-by-side
checkutf8.py
View file @
77948d9c
...
...
@@ -9,7 +9,7 @@ def check_utf8(s, oikea, makspisteet, binary=False):
:return: tehtävästä saadut pisteet, virheet (tai "" jos oikein)
'''
#print(oikea)
#s = s.replace(" ", "").replace("\n", "") # Strip if someone give eg '10101110 10110101'
#
s = s.replace(" ", "").replace("\n", "") # Strip if someone give eg '10101110 10110101'
s
=
re
.
sub
(
r
'\s+'
,
''
,
s
)
# remove (all) (white)spaces
palaute_viesti
=
""
...
...
@@ -40,6 +40,7 @@ def check_utf8(s, oikea, makspisteet, binary=False):
if
__name__
==
'__main__'
:
import
sys
import
re
try
:
p
,
v
=
check_utf8
(
open
(
sys
.
argv
[
1
],
'r'
).
read
(),
sys
.
argv
[
2
],
float
(
sys
.
argv
[
3
]))
#except FileNotFoundError: # voidaan käyttää myös tekstin tarkastamiseen, jolloin oikea vastaus annetaan binäärisenä ja parametrien järjestystä muutetaan
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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