Can any one give solution to processing Chinese characters by python on linux?

Advertisements Any concrete correct document or code or demo are welcome. there are so many messy articles about such problem, and they are not valid. >Solution : At the beginning of the program, write down # –– coding: UTF-8 –– Or you may write at beginning of the source code of your program # coding=utf-8… Read More Can any one give solution to processing Chinese characters by python on linux?

Convert "weird" strings to normal python strings

Advertisements Context: I’m trying to convert characters like these: 𝐁𝐔𝐈𝐋𝐃𝐈𝐍𝐆 𝙎𝙥𝙚𝙚𝙙𝙮 𝕋𝕌𝔼𝕊𝔻𝔸𝕐 𝕤𝕡𝕒𝕘𝕙𝕖𝕥𝕥𝕚 To normal python strings (speedy, building, tuesday, etc) and save them into a new dataframe to be exported into a new excel file. For example, the charcter 𝕒 (U+1D552) should be converted to a (U+00AA). I’m reading each string from an excel… Read More Convert "weird" strings to normal python strings

Converting HTML Code to human understandable code

Advertisements Most of my content in the database is recorded in this way. How can this be translated into HTML code structure? &#x3C;div class=&#x22;main_title mb-4&#x22;&#x3E;n&#x9;&#x9;&#x9;&#x9;&#x3C;h2&#x3E;New Arrival&#x3C;/h2&#x3E;n&#x9;&#x9;&#x9;&#x9;&#x3C;span&#x3E;Products&#x3C;/span&#x3E;n&#x9;&#x9;&#x9;&#x9;&#x3C;p&#x3E;Cum doctus civibus efficiantur in imperdiet deterruisset.&#x3C;/p&#x3E;n&#x9;&#x9;&#x9;&#x3C;/div&#x3E;n&#x9;&#x9;&#x9;&#x3C;div class=&#x22;isotope_filter&#x22;&#x3E;n&#x9;&#x9;&#x9;&#x9;&#x3C;ul&#x3E;&#x3C;li&#x3E;&#x3C;a href=&#x22;http://www.example.com/index-2.html#0&#x22; id=&#x22;all&#x22; data-filter=&#x22;*&#x22;&#x3E;All&#x3C;/a&#x3E;&#x3C;/li&#x3E;&#x3C;li&#x3E;&#x3C;a href=&#x22;http://www.example.com/index.html#0&#x22; id=&#x22;popular&#x22; data-filter=&#x22;.popular&#x22;&#x3E;Popular&#x3C;/a&#x3E;&#x3C;/li&#x3E;&#x3C;li&#x3E;&#x3C;a href=&#x22;http://www.example.com/index-2.html#0&#x22; id=&#x22;sale&#x22; data-filter=&#x22;.sale&#x22;&#x3E;Sale&#x3C;/a&#x3E;&#x3C;/li&#x3E;&#x3C;/ul&#x3E;n&#x9;&#x9;&#x9;&#x3C;/div&#x3E; Convert to: <div class="main_title mb-4">n <h2>New Arrival</h2>n <span>Products</span>n <p>Cum doctus civibus efficiantur in… Read More Converting HTML Code to human understandable code

How to convert UTF-8 notation to python unicode notation

Advertisements Using python3.8 I would like to convert unicode notation to python notation: s = ‘U+00A0’ result = s.lower() # output ‘u+00a0’ I want to replace u+ with \u: result = s.lower().replace(‘u+’,’\u’) But I get the error: SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 0-1: truncated \uXXXX escape How can I convert… Read More How to convert UTF-8 notation to python unicode notation

How to display accented words JSON on bash script with Python

Advertisements I’m trying to display arrays with accent in the result but only arrays that don’t have accent are showing. Complete themoviedb API: https://api.themoviedb.org/3/movie/566525?api_key=b2f8880475c888056b6207067fbaa197&language=pt-BR "genres": [ { "id": 28, "name": "Ação" }, { "id": 12, "name": "Aventura" }, { "id": 14, "name": "Fantasia" } ], "overview": "Shang-Chi precisa confrontar o passado que pensou ter deixado… Read More How to display accented words JSON on bash script with Python

Use string as bytes

Advertisements My problem is as follows: I’m reading a .csv generated by some software and to read it I’m using Pandas. Pandas read the .csv properly but one of the columns stores bytes sequences representing vectors and Pandas stores them as a string. So I have data (string) and I want to use np.frombuffer() to… Read More Use string as bytes