Micropython strings

会有一股神秘感。 提交于 2019-12-25 16:57:31

问题


Using Micropython sockets I received a message which contained the following string:

b'xxx/yyy'

I don't know how the "b" got there, or what it is !!!

I can also enter this using an input statement

    x = input('Enter:')
>>> b'xxx/yyy'
    print(x)
>>> b'xxx/yyy'
    print (len(x))
>>> 7
    L = []
    L = x.split('/')
>>> TypeError: can't convert 'str' object to str implicitly

There must be a simple explanation to this, but I can not see it.

Is this some new type of variable ???


回答1:


It states that it is a utf-8 decoded string enclosed in a bytearray!!



来源:https://stackoverflow.com/questions/41642783/micropython-strings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!