标签:end images 下标 little 增加 http 词频统计 append es2017
1.
read=‘‘‘Zhuang Zhou‘s family was poor. Once, he went to the official who supervised1 rivers to borrow some grain. The official said: "Well, wait until the end of the year when I collect the taxes from the people, then I will lend you 300 gold pieces. All right?"
When Zhuang Zhou heard this, he was so angry that the colow of his face changed. But he told the official this story: When I came here yesterday, on the way I heard a voice calling ‘Help!‘ I turned my head and saw a small crucian carp in the dried-up carriage ditch2."
I went over and asked: "Little crucian carp, why are you calling for help?"‘‘‘
read=read.lower()
for i in ‘,.!?‘:
read=read.replace(i,‘‘)
words=read.split()
print(words)
print(‘he‘,words.count(‘he‘))
print(‘i‘,words.count(‘i‘))
2.
fen=list(‘1232112‘)
print(‘原本:‘,fen)
fen.append(‘3‘)
print(‘增加‘3’:‘,fen)
fen.insert(1,‘1‘)
print(‘插入1:‘,fen)
fen.pop()
print(‘删除:‘,fen)
fen[2]=‘3‘
print(‘修改‘,fen)
print(‘第0位是:‘,fen[0])
print(‘3的下标是:‘,fen.index(‘3‘))
print(‘1的数量:‘,fen.count(‘1‘))
print(‘1的数量:‘,fen.count(‘3‘))
for i in range(len(fen)):
fen[i]=int(fen[i])
print(fen)
3.
1)list是一个使用方括号括起来的有序元素集合。list可以增删改查
2)Tuple是不可变的list.一是创建了一个tuple就不能以任何方式改变它。定义tuple与定义list的方式相同,除了整个元素集是用小括号包围的而不是方括号。
标签:end images 下标 little 增加 http 词频统计 append es2017
原文地址:http://www.cnblogs.com/D0204/p/7565134.html