Files
cdtestplant_v1/test.ipynb
2026-01-28 16:50:40 +08:00

56 lines
1022 B
Plaintext

{
"cells": [
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2026-01-28T04:26:42.103401300Z",
"start_time": "2026-01-28T04:26:42.066578300Z"
}
},
"source": [
"arr = [1, 2, 3, 4, 5]\n",
"a = 1\n",
"b = 3\n",
"b_index = arr.index(b)\n",
"arr.remove(a)\n",
"arr.insert(b_index - 1, a)\n",
"print(arr)"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2, 1, 3, 4, 5]\n"
]
}
],
"execution_count": 2
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}