Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algoritmer og datastrukturer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jacob Theisen
Algoritmer og datastrukturer
Commits
da8b863f
Commit
da8b863f
authored
Nov 8, 2021
by
Jacob Theisen
Browse files
Options
Downloads
Patches
Plain Diff
sjo
parent
12b7290f
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ov8/comp.py
+3
-4
3 additions, 4 deletions
ov8/comp.py
ov8/dcomp.py
+3
-3
3 additions, 3 deletions
ov8/dcomp.py
ov8/trash/test
+0
-0
0 additions, 0 deletions
ov8/trash/test
ov8/trash/test.py
+52
-1
52 additions, 1 deletion
ov8/trash/test.py
with
58 additions
and
8 deletions
ov8/comp.py
+
3
−
4
View file @
da8b863f
...
@@ -5,8 +5,7 @@ with open('./fil.txt') as file:
...
@@ -5,8 +5,7 @@ with open('./fil.txt') as file:
#def checkstring(string):
# check if string contains ascii
...
@@ -67,9 +66,9 @@ with open('./compresed', 'w') as file:
...
@@ -67,9 +66,9 @@ with open('./compresed', 'w') as file:
print
(
a
)
print
(
a
)
i
=
0
i
=
0
a
=
a
.
replace
(
'
å
'
,
'
a
'
)
'''
a = a.replace(
'
å
'
,
'
a
'
)
a = a.replace(
'
ø
'
,
'
o
'
)
a = a.replace(
'
ø
'
,
'
o
'
)
a
=
a
.
replace
(
'
æ
'
,
'
e
'
)
a = a.replace(
'
æ
'
,
'
e
'
)
'''
'''
'''
while i < len(a):
while i < len(a):
...
...
This diff is collapsed.
Click to expand it.
ov8/dcomp.py
+
3
−
3
View file @
da8b863f
...
@@ -5,13 +5,13 @@ with open('./compresed', 'rb') as file:
...
@@ -5,13 +5,13 @@ with open('./compresed', 'rb') as file:
def
dcomp
():
def
dcomp
():
dcomp_arr
=
bytearray
(
''
,
'
utf-8
'
)
dcomp_arr
=
[]
i
=
0
i
=
0
dcomp_string
=
''
dcomp_string
=
''
togle_not_bytes
=
False
togle_not_bytes
=
False
while
i
<
(
len
(
tekst
)):
while
i
<
(
len
(
tekst
)):
if
togle_not_bytes
:
if
togle_not_bytes
:
dcomp_arr
.
extend
(
tekst
[
i
:
i
+
num
])
dcomp_arr
.
extend
(
tekst
[
i
:
i
+
num
]
.
decode
(
'
utf-8
'
)
)
togle_not_bytes
=
False
togle_not_bytes
=
False
i
+=
num
i
+=
num
else
:
else
:
...
@@ -27,7 +27,7 @@ def dcomp():
...
@@ -27,7 +27,7 @@ def dcomp():
togle_not_bytes
=
True
togle_not_bytes
=
True
num
=
value
num
=
value
i
+=
2
i
+=
2
dcomp_string
=
''
.
join
(
map
(
chr
,
dcomp_arr
)
)
dcomp_string
=
''
.
join
(
dcomp_arr
)
return
dcomp_string
return
dcomp_string
...
...
This diff is collapsed.
Click to expand it.
ov8/trash/test
0 → 100644
+
0
−
0
View file @
da8b863f
File added
This diff is collapsed.
Click to expand it.
ov8/trash/test.py
+
52
−
1
View file @
da8b863f
...
@@ -28,4 +28,55 @@ print(b)
...
@@ -28,4 +28,55 @@ print(b)
c = -((b ^ 0xff)+1)
c = -((b ^ 0xff)+1)
print(c)
'''
print(c)
'''
print
(
b
''
)
import
string
\ No newline at end of file
'''
def checkstring(sjo):
ascii = string.printable
num = 0
for i in sjo:
if i not in ascii:
num +=1
return num
b = checkstring(
'
åøæ
'
)
print(b)
'''
with
open
(
'
./test
'
,
'
wb
'
)
as
file
:
int2
=
int
(
'
78
'
)
file
.
write
(
int2
.
to_bytes
(
2
,
'
little
'
))
with
open
(
'
./test
'
,
'
a
'
)
as
file
:
file
.
write
(
'
abÅ
'
)
with
open
(
'
./test
'
,
'
rb
'
)
as
file
:
tekst
=
file
.
read
()
arr
=
bytearray
(
''
,
'
utf-8
'
)
array
=
[]
str
=
''
for
i
in
range
(
len
(
tekst
)):
print
(
i
)
if
i
==
1
:
continue
if
i
==
0
:
value
=
tekst
[
i
:
i
+
2
]
value
=
int
.
from_bytes
(
value
,
"
little
"
)
print
(
value
)
#bytearray.extend(value)
continue
array
.
extend
(
tekst
[
i
:].
decode
(
'
utf-8
'
))
print
(
array
)
print
(
''
.
join
(
map
(
chr
,
arr
)))
exit
()
'''
string_to_test =
'
abå
'
def test():
res = b
"
0x00ab
"
print(res)
test()
'''
#å=Ã¥ Å=
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
sign in
to comment