kopia lustrzana https://github.com/micropython/micropython-lib
os: Add fsencode() & fsdecode().
rodzic
886587bd72
commit
dc6a6d096f
|
@ -1,4 +1,4 @@
|
|||
srctype = micropython-lib
|
||||
type = package
|
||||
version = 0.0.7
|
||||
version = 0.0.8
|
||||
author = Paul Sokolovsky
|
||||
|
|
|
@ -159,3 +159,14 @@ def waitpid(pid, opts):
|
|||
r = waitpid_(pid, a, opts)
|
||||
check_error(r)
|
||||
return (r, a[0])
|
||||
|
||||
|
||||
def fsencode(s):
|
||||
if type(s) is bytes:
|
||||
return s
|
||||
return bytes(s, "utf-8")
|
||||
|
||||
def fsdecode(s):
|
||||
if type(s) is str:
|
||||
return s
|
||||
return str(s, "utf-8")
|
||||
|
|
|
@ -6,7 +6,7 @@ from setuptools import setup
|
|||
|
||||
|
||||
setup(name='micropython-os',
|
||||
version='0.0.7',
|
||||
version='0.0.8',
|
||||
description='os module for MicroPython',
|
||||
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
|
||||
url='https://github.com/micropython/micropython/issues/405',
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import os
|
||||
|
||||
print(os.fsencode("abc"))
|
||||
print(os.fsencode(b"abc"))
|
||||
|
||||
print(os.fsdecode("abc"))
|
||||
print(os.fsdecode(b"abc"))
|
Ładowanie…
Reference in New Issue