del如下。pop彈出元素并返回。
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),邵東企業(yè)網(wǎng)站建設(shè),邵東品牌網(wǎng)站建設(shè),網(wǎng)站定制,邵東網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,邵東網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。
print(x)
[1, 2, 5, 6, 8, 4, 3, 5]
del x[3]
print(x)
[1, 2, 5, 8, 4, 3, 5]
y=x.pop()
print(y)
5
x
print(x)
[1, 2, 5, 8, 4, 3]
print(x)
[1, 2, 5, 8, 4, 3]
x
z=x.pop(3)
print(x)
[1, 2, 5, 4, 3]
z
print(z)
8
x1=(1,2,"aaaa")
x2=(3,4,"bbbb")
x1,x2
print(x1,x2)
(1, 2, 'aaaa') (3, 4, 'bbbb')
x1
(1, 2, 'aaaa')
x2
x2
(3, 4, 'bbbb')
print(x1[0],x1[1])
1 2
print(x2[2],x1[1])
bbbb 2
```python
str='1234\n5aaaaa'
print(str)
str="123\n45'aaaa'a"
print(str)
1234
5aaaaa
123
45'aaaa'a
str="""
adfdf
{asdf}
//2qerffasda
"""
print(str)
str='''adfdf
{asdf}
//2qerffasda'''
print(str)
adfdf
{asdf}
//2qerffasda
adfdf
{asdf}
//2qerffasda
str="""123\n45'aaaa'a"""
print(str)
str='''123\n45'aaaa'a'''
print(str)
str='''
123\n45'aaaa'a
'''
print(str)
123
45'aaaa'a
123
45'aaaa'a
123
45'aaaa'a
str='''
123\n
45'aaaa'a
'''
print(str)
123
45'aaaa'a
可見三引號中轉(zhuǎn)義字符還是有作用,但使用r則可以消除轉(zhuǎn)義字符的作用
str='''
123\n
45'aaaa'a
aa\\
bb
'''
print(str)
str=r'''
123\n
45'aaaa'a
aa\\
bb
'''
print(str)
123
45'aaaa'a
aa\
bb
123\n
45'aaaa'a
aa\\
bb
s="ssadf"
print(s)
del s
print(s)
ssadf
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
in
2 print(s)
3 del s
----> 4 print(s)
NameError: name 's' is not defined
print(x)
x3=tuple(x)
print(x3)
[1, 2, 5, 4, 3, 10, 20, [1, 2]]
(1, 2, 5, 4, 3, 10, 20, [1, 2])
print(x3[5],x3[6])
10 20
1
print(x[7][0])
print(x[7][1])
1
2