125 lines
3.6 KiB
Plaintext
125 lines
3.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"42\n",
|
|
"46\n",
|
|
"[2, 4, 6, 23, 23, 26, 26, 42, 43, 45, 47, 48, 61, 65, 85, 105, 127, 143, 145, 145, 165, 183, 222, 225, 242, 248, 262, 264, 265, 265, 266, 267, 284, 288, 289, 303, 304, 306, 523, 563, 564, 702]\n",
|
|
"[2, 4, 6, 22, 22, 23, 26, 26, 42, 43, 45, 47, 48, 61, 64, 64, 85, 105, 127, 143, 145, 145, 165, 183, 222, 225, 242, 248, 262, 264, 265, 265, 266, 267, 284, 288, 289, 303, 304, 306, 521, 521, 522, 563, 564, 702]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"str = \"\"\"0@0@0@26:702 0@1@0@-1:26 0@2@0@-1:23 0@3@0@-1:303 0@4@0@-1:284 0@5@0@-1:43 0@6@0@-1:2 0@7@0@-1:65 0@8@0@2:85 1@0@0@-1:288 1@1@0@-1:61 1@2@0@-1:242 1@5@0@-1:6 1@6@0@-1:45 1@7@0@-1:47 1@8@0@21:183 2@0@0@-1:26 2@1@0@24:564 2@7@0@-1:42 2@8@0@4:105 3@0@0@16:563 3@1@0@-1:4 3@2@0@-1:265 3@6@0@-1:304 3@7@0@-1:222 3@8@0@-1:23 4@0@1@-1:289 4@1@0@-1:266 4@2@0@-1:265 4@7@0@-1:143 4@8@1@-1:306 5@0@0@-1:48 5@1@0@-1:248 5@2@0@-1:262 5@7@0@27:145 5@8@0@28:145 6@0@0@15:165 6@1@0@-1:264 6@2@0@-1:523 6@6@0@-1:225 6@7@0@22:127 6@8@1@-1:267\"\"\"\n",
|
|
"\n",
|
|
"str2 = \"\"\"289 61 105 165 48 85 26 183 306 127 288 266 64 563 26 145 145 143 303 304 284 702 23 6 42 43 45 47 222 225 265 267 22 22 2 4 522 264 265 521 262 242 248 64 521 564\"\"\"\n",
|
|
"\n",
|
|
"a1 = str.split(\" \")\n",
|
|
"a2 = str2.split(\" \")\n",
|
|
"print(len(a1))\n",
|
|
"print(len(a2))\n",
|
|
"l1 = []\n",
|
|
"l2 = []\n",
|
|
"for i in a1:\n",
|
|
" l1.append(int(i.split(\":\")[1]))\n",
|
|
"for i in a2:\n",
|
|
" l2.append(int(i))\n",
|
|
"l1.sort()\n",
|
|
"l2.sort()\n",
|
|
"print(l1)\n",
|
|
"print(l2)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"3/Qr-g]ljJ&9@bM&\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import random\n",
|
|
"import string\n",
|
|
"\n",
|
|
"def generate_random_string(length):\n",
|
|
" # 定义要使用的字符集\n",
|
|
" characters = string.ascii_letters + string.digits + string.punctuation\n",
|
|
" # 生成随机字符串\n",
|
|
" random_string = ''.join(random.choice(characters) for i in range(length))\n",
|
|
" return random_string\n",
|
|
"\n",
|
|
"# 示例:生成一个长度为 12 的随机字符串\n",
|
|
"random_string = generate_random_string(16)\n",
|
|
"print(random_string)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"日期时间: 2024-12-26 20:39:44\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from datetime import datetime\n",
|
|
"\n",
|
|
"# 示例时间戳\n",
|
|
"timestamp = 1735216784\n",
|
|
"\n",
|
|
"# 将时间戳转换为日期时间\n",
|
|
"dt_object = datetime.fromtimestamp(timestamp)\n",
|
|
"\n",
|
|
"# 打印日期时间\n",
|
|
"print(\"日期时间:\", dt_object)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.13.0"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|