File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed
Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -383,10 +383,7 @@ $ google-chrome --proxy-server="socks5://192.168.2.157"
383383
384384ubuntu 解压 RAR
385385```
386- # 安装
387- $ sudo apt-get install rar
388- # 解压
389- $ rar x FileName.rar
386+ $ sudo apt-get install p7zip-rar
390387```
391388
392389统计当前目录下指定后缀名的文件总个数命令
Original file line number Diff line number Diff line change @@ -21,6 +21,31 @@ def hex_to_bytes(string):
2121 return bytes (tmp )
2222
2323
24+ def test_unescape ():
25+ # unicode编码后的汉字的解析
26+ str_xx = '加入到"我的书目选单"中'
27+ from HTMLParser import HTMLParser
28+ h = HTMLParser ()
29+ print h .unescape (str_xx )
30+
31+
32+ def test_unicode ():
33+ a = '\u6211 \u6765 \u4e86 '
34+ print a .decode ('raw_unicode_escape' ) # 我来了
35+
36+ # =============
37+ # 通用转换方法:
38+
39+ # python 2.x str 转 unicode:
40+ # str_string.decode('original_encoding')
41+ print repr ('我来了' .decode ('utf-8' )), '我来了' .decode ('utf-8' )
42+
43+ # unicode 转 str:
44+ # unicode_string.encode('target_encoding')
45+ print repr (u'\u6211 \u6765 \u4e86 ' .encode ('utf-8' )), u'\u6211 \u6765 \u4e86 ' .encode ('utf-8' ) # 每个汉子占3个字节
46+ print repr (u'\u6211 \u6765 \u4e86 ' .encode ('GBK' )), u'\u6211 \u6765 \u4e86 ' .encode ('GBK' ) # 每个汉子占2个字节
47+
48+
2449def test ():
2550 """
2651 转换测试
@@ -49,6 +74,8 @@ def test():
4974 test ()
5075 print system_to_decimal ('000000001b2025f6' , 16 )
5176 print system_to_decimal ('0001000100010001' , 2 )
77+ test_unescape ()
78+ test_unicode ()
5279
5380
5481"""
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ def get_count_by_sql(self, sql=None):
127127
128128 def get_rows_by_sql (self , sql = None ):
129129 """
130- 获取记录总数
130+ 获取记录
131131 :return:
132132 """
133133 if self .is_conn_open () is False :
You can’t perform that action at this time.
0 commit comments