Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
ORG.Asm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ORG.Asm
ORG.Asm
Commits
9fc2a2b2
Commit
9fc2a2b2
authored
Apr 11, 2016
by
Eric Coissac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add to basic conversion function between str and bytes
parent
21285286
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
python/orgasm/utils/__init__.py
python/orgasm/utils/__init__.py
+24
-0
No files found.
python/orgasm/utils/__init__.py
View file @
9fc2a2b2
from
._progress
import
progressBar
def
str2bytes
(
string
):
"""
Short cut to convert ascii encoded python string (str) to bytes
which can be easily converted to C-strings.
@param string: the python string to be converted.
@type string: str
@return a transcoded string
@rtype: bytes
"""
return
string
.
encode
(
'ascii'
)
def
bytes2str
(
string
):
"""
Short cut to convert bytes (C-strings) to ascii encoded python string (str).
@param string: the binary (C-string) string to be converted.
@type string: bytes
@return an ascii transcoded string
@rtype: str
"""
return
string
.
decode
(
'ascii'
)
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