面试题

1、10个Linux常用命令

  ls  pwd  cd  cat   

  touch   rm    mkdir 

     cp    mv   more   less   

  grep   echo  su

 

2、*arg和**kwarg作用

# 他们是一种动态传参,一般不确定需要传入几个参数时,可以使用其定义参数,然后从中取参

'*args':按照位置传参,将传入参数打包成一个‘元组’(打印参数为元组-- tuple)
'**kwargs':按照关键字传参,将传入参数打包成一个‘字典’(打印参数为字典-- dict)

3、字符串a = "not 404 found 张三 99 深圳",每个词中间是空格,用正则过滤掉英文和数字,最终输出"张三 深圳"

import re 
a = "not 404 found 张三 99 深圳"
l1 = a.split ("")
print(l1)	
res = re.findall('\d+|[a-zA-Z]+',a)
for i in res:
    if i in l1:
        l1.remove(i)
new_str = "".join(l1)
print(res)
print(new_str)   

  

posted @ 2018-12-26 13:44  繁星十月  阅读(408)  评论(0编辑  收藏  举报