This commit is contained in:
512song committed 2023-05-14 22:21:14 +08:00
1 parent 3c8e9c5157
commit c7c9e34af4
4 files changed
+467 -105

No files matched your search

+68 -5
View File
@@ -114,16 +114,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-09T03:14:50.263302Z",
"iopub.status.busy": "2023-05-09T03:14:50.262465Z",
"iopub.status.idle": "2023-05-09T03:14:50.269294Z",
"shell.execute_reply": "2023-05-09T03:14:50.268106Z",
"shell.execute_reply.started": "2023-05-09T03:14:50.263258Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['气郁组']\n"
]
}
],
"source": [
"import re\n",
"\n",
"s = '2022-09-28-《气郁组》-视频学习详情_155229'\n",
"m = re.findall(r'《(.+)》',s)\n"
"m = re.findall(r'《(.+)》',s)\n",
"print(m)"
]
},
{
@@ -164,6 +180,53 @@
"print(int(days))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 字符串转换"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-12T04:10:03.168210Z",
"iopub.status.busy": "2023-05-12T04:10:03.167782Z",
"iopub.status.idle": "2023-05-12T04:10:03.176045Z",
"shell.execute_reply": "2023-05-12T04:10:03.174828Z",
"shell.execute_reply.started": "2023-05-12T04:10:03.168182Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bs b'\\xc0\\xee\\xb5t'\n",
"decode-bs: 李祎\n",
"gbcode: b'\\xc2\\xed\\xc1\\xa2\\xd1\\xc7'\n",
"gbs: c2edc1a2d1c7\n"
]
}
],
"source": [
"import binascii\n",
"\n",
"gbs = 'C0EEB574'\n",
"bs = binascii.a2b_hex(gbs)\n",
"print('bs', bs)\n",
"print('decode-bs:', bs.decode('gbk'))\n",
"\n",
"s = '马立亚'\n",
"gbcode = s.encode('gbk') # 先转成 bytes格式\n",
"print('gbcode:', gbcode)\n",
"gbs = \"\".join([hex(ch)[2:] for ch in gbcode]) #\n",
"print('gbs:', gbs)"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -1411,7 +1474,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -1425,7 +1488,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.6"
}
},
"nbformat": 4,