<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 開頭r b u f 含義 * `b` bytes字節符,打印以b開頭。 ``` b'input\n' 輸出: b'input\n' ``` * `r `非轉義原生字符,經處理'\n'變成了'\\'和'n'。也就是\n表示的是兩個字符,而不是換行。 ``` r'input\n' # 輸出:'input\\n' ``` * `u` unicode編碼字符,python3默認字符串編碼方式。 ``` u'input\n' 輸出:'input\n' ``` * ` f `以f開頭表示在字符串內支持大括號內的python 表達式 ``` import time t0 = time.time() time.sleep(1) name = 'processing' print(f'{name} done in {time.time() - t0:.2f} s') 輸出:processing done in 1.00 s ``` * str與bytes轉換 ``` str = "€20" print(str.encode("utf-8")) print(str.encode("utf-8").decode("utf-8")) ``` ``` s1 = '123' print(s1) print(type(s1)) s2 = b'123' print(s2) print(type(s2)) 區別輸出: 123 <class 'str'> b'123' <class 'bytes'> ``` * Python 3 將字符串處理為 unicode 類型。 ``` str轉bytes: bytes('123', encoding='utf8') str.encode('123') bytes轉str: str(b'123', encoding='utf-8') bytes.decode(b'123') ``` python3 文件默認編碼是utf-8 , 字符串編碼是 unicode 以utf-8 或者 gbk等編碼的代碼,加載到內存,會自動轉為unicode正常顯示。 ![](https://box.kancloud.cn/7b9068c459645423041f33b0e7a40e94_276x176.png) [ Python常見字符編碼及其之間的轉換](https://blog.csdn.net/sinat_36972314/article/details/79745438)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看