1 t1=[x for x in range(5)]
2 t2=[x for x in range(5,10)]
3
4 #way1:通过方法extend(),直接修改列表,无返回值
5 # t1.extend(t2)
6 # print(t1)
7 # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
8
9 #way2:通过列表切片,可在列表任意位置插入
10 # t2[:0]=t1 #插入到头部
11 # print(t2)
12 # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
13
14 #插入到中部
15 # t1[3:0]=t2 # 索引3 开始为插入的列表
16 # print(t1)
17 # [0, 1, 2, 5, 6, 7, 8, 9, 3, 4]
18
19 #插入到尾部
20 # t1[len(t1):0]=t2
21 # print(t1)
22 # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

python3 list合并的更多相关文章

  1. python3实现合并两个有序数组

    很早就听同学和师兄经常说刷题很重要,然而编程能力一直都很渣的我最近才开始从leetcode的初级算法开始.今天遇到的这道题虽然很简单,因为是头一次用自己的方法速度还不错,特此记录一下,还大神们请不要嘲 ...

  2. Python3对比合并Excel表格

    ##安装模块pip install pandas as pdpip install xlsxwriterpip install openpyxl ##带入模块import pandas as pdim ...

  3. Python3 的urllib实例

    在Python3中合并了 urllib 和 urllib2, 统一命名为 urllib 了,我觉得这样更加合理了.让我们可以像读取本地文件一样读取WEB上的数据.封装了一个类,供以后方便使用吧!并附带 ...

  4. Leecode刷题之旅-C语言/python-88合并两个有序数组

    /* * @lc app=leetcode.cn id=88 lang=c * * [88] 合并两个有序数组 * * https://leetcode-cn.com/problems/merge-s ...

  5. Leecode刷题之旅-C语言/python-21.合并两个有序链表

    /* * @lc app=leetcode.cn id=21 lang=c * * [21] 合并两个有序链表 * * https://leetcode-cn.com/problems/merge-t ...

  6. Python之路【第二十三篇】爬虫

    difference between urllib and urllib2 自己翻译的装逼必备 What is the difference between urllib and urllib2 mo ...

  7. 井字棋(Tic-Tac-Toe)

    井字棋介绍:https://en.wikipedia.org/wiki/Tic-tac-toe 井字棋简单,但是获胜策略却和直觉不同,四角比中间重要性要高,而且先手有很大的获胜概率获胜(先手胜:91, ...

  8. urllib 学习一

    说明:Urllib 是一个python用于操作URL的模块   python2.x    ----> Urillib/Urllib2 python3.x    ----> Urllib  ...

  9. 安装python各类工具包、IDE以及著名开源模块如kaldi等的简单总结

    在学习一门语言或者使用一个著名的开源工具时,搭建环境是非常重要的一步,在环境搭建的过程中往往要踩很多坑.昨天一不小心把电脑操作系统整坏了,搞了个通宵算是搞定了,把win10系统重装回win7,但之前搭 ...

随机推荐

  1. openssl的用法

    Openssl详细用法: OpenSSL 是一个开源项目,其组成主要包括一下三个组件: openssl:多用途的命令行工具 libcrypto:加密算法库 libssl:加密模块应用库,实现了ssl及 ...

  2. webpack remove console.log

    webpack remove console.log https://stackoverflow.com/questions/41040266/remove-console-logs-with-web ...

  3. set CSS style in js solutions All In One

    set CSS style in js solutions All In One css in js set each style property separately See the Pen se ...

  4. PerformanceObserver API All In One

    PerformanceObserver API All In One 性能监控 https://developer.mozilla.org/en-US/docs/Web/API/Performance ...

  5. TypeScript & as & Type Assertion

    TypeScript & as & Type Assertion Type Assertion (as) That is not vanilla JavaScript, it is T ...

  6. W3C & 弹幕

    W3C & 弹幕 弹幕用例规范 Draft Community Group Report 21 August 2020 refs https://w3c.github.io/danmaku/u ...

  7. ESLint All In One

    ESLint All In One ESLint $ yarn add -D eslint .eslintrc.{js,yml,json} 优先级 .eslintrc .eslintrc.js .es ...

  8. img & srcset

    img & srcset 性能优化 <img class="fn tj s t u fa ai ht" width="3700" height=& ...

  9. input change only trigger once bug

    input change only trigger once bug clear first https://stackoverflow.com/a/11280934/5934465 upload E ...

  10. SVG namespace & preview bug

    SVG namespace & preview bug error This XML file does not appear to have any style information as ...