Python_Built-in Types_list.extend
来源:互联网 发布:mysql ibata文件 编辑:程序博客网 时间:2024/06/06 02:16
API文档:
array.extend(iterable)
Append items from iterable to the end of the array. If iterable is another array, it must have exactly the same type code; if not, TypeError will be raised. If iterable is not an array, it must be iterable and its elements must be the right type to be appended to the array.
翻译文档:
参数:
iterable:为一个数组或是string等
描述:
将iterable数组或是字符串追加到array中末尾。
如果iterable为一个其他类型,则返回一个TypeError异常。如果iterable为字符串或是数组、元组等,则追加到array末尾
例子:
#! /usr/bin/env python
#coding=utf-8
list1=['a','b','c']
list2=['h','j']
print list1
list1.extend(list2)
print list1
list2=[1,'2']
list1.extend(list2)
print list1
list1.extend(1)
print list1
输出:
['a', 'b', 'c']
['a', 'b', 'c', 'h', 'j']
['a', 'b', 'c', 'h', 'j', 1, '2']
Traceback (most recent call last):
File "F:\pyWorkSpace\notes\API\array_extend.py", line 15, in <module>
list1.extend(1)
TypeError: 'int' object is not iterable
- Python_Built-in Types_list.extend
- Oracle unable to extend table in tablespace
- extend
- $extend()
- extend
- $.extend()
- $.extend
- $.extend()
- $.extend
- $.extend
- $.extend
- $.extend
- $.extend
- extend()
- Extend ext3 filesystem for RH5 Virtual Machine running in vCluster
- How to extend the root partition in LVM
- unable to extend temp segment by 128 in tablespace name
- jQuery.extend $.extend详解
- flash cs5 书写代码的好习惯
- 关于提高效率的三个建议
- modern C++ design type2type 笔记
- web profiler 环境搭建
- MapReduce技术的初步了解与学习
- Python_Built-in Types_list.extend
- VirtualBox安装Centos,配置网络(主机可以通过SSH连接虚拟机系统,同时虚拟机系统可以访问外网)
- Linux操作系统上Lsof命令详解
- 从现在起
- C语言复习1
- 排序
- C语言复习2
- Page分页和封装page页面
- WegLogic 简介,下载,安装,部署项目