怎么移除python数组中每一个元素的第一个字符?

我的数组是这样的
array = [@SAchrisINuk "When students start making #youtube vids about how #java is their passion #ProudTeacher #CompSci #computing http://t.co/GgkhJdqiRx" 2011 9 29 11:29:18,
@drmauricedawson "http://t.co/ZExyNjfEBn via @researchgate #china #africa #latin #IEEE #modeling #systems #virtual #open #source #linux #compsci" 2011 9 29 04:56:41,
@24Blackout7live "RT @drmauricedawson: http://t.co/EoLPqI8HxQ via @researchgate #cyber #android #hacking #compsci #AAMU #HBCU #MYASU" 2011 9 29 04:50:28]
我要移除每一个最前面的@。

第1个回答  推荐于2016-03-18
tmp=['@123','@321','@111']
print map(lambda x:x[1:],tmp)

追问

大神你又出现了TAT。太好了。感谢啊Preferences§1234567890-=BackspaceTabqwertyuiop[]Returncapslockasdfghjkl;'\shift`zxcvbnm,./shiftEnglishDeutschEspañolFrançaisItalianoPortuguêsРусскийaltaltPreferences

追答刚才那段代码:
import re
import datetime
with open('a.txt','r') as f0:
    array=f0.readlines()
    array=map(lambda x:x[1:],array)#删除了第一个字符
r0=re.compile(r'\d{4}\s+\d{1,2}\s+\d{1,2}\s+\d+:\d+:\d+')
with open('b.txt','w') as f1:
    f1.writelines(sorted(array,key=lambda x:datetime.datetime.strptime(r0.findall(x)[-1],'%Y %m %d %H:%M:%S')))

本回答被提问者采纳
第2个回答  2015-11-21

代码如下:

arr=[]
for aa in arr:
    aa=str(aa)[1:]

相似回答