网站平台建设实训心得体会,关于网站建设广告词,网站开发技术选择,网站建设velpai1、编写可供用户查询的员工信息表#xff1a;1).用户认证(输入用户名#xff0c;密码)2).查询关键字#xff1a;姓名3).显示ID#xff0c;name#xff0c;section#xff0c;phone4).员工信息表内容如下#xff1a;cat search_name.txt001wenlong IT12345678002xiaojun …1、编写可供用户查询的员工信息表1).用户认证(输入用户名密码)2).查询关键字姓名3).显示IDnamesectionphone4).员工信息表内容如下cat search_name.txt001wenlong IT12345678002xiaojun IT12345678003ankang IT12345678004xiang IT12345678脚本如下#!/usr/bin/python#-*- coding:utf-8 -*-        #输入这一条就可以在Python脚本里面使用汉语注释此脚本可以直接复制使用while True:            #进入死循环input  raw_input(Please input your username:)    #交互式输入用户信息输入input信息if input  wenlong:        #如果input等于wenlong则进入此循环(如果用户输入wenlong)password  raw_input(Please input your pass:)    #交互式信息输入输入password信息p  123                  #设置变量P赋值为123while password ! p:         #如果输入的password 不等于p(123) 则进此入循环password  raw_input(Please input your pass again:)    #交互式信息输入输入password信息if password  p:        #如果password等于p(123)则进入此循环print welcome to select system!              #输出提示信息while True:           #进入循环match  0     #设置变量match等于0input  raw_input(Please input the name whom you want to search :)   #交互式信息输入输入input信息while not input.strip():   #判断input值是否为空如果input输出为空则进入循环input  raw_input(Please input the name whom you want to search :)        #交互式信息输入输入input信息name_file  file(search_name.txt)     #设置变量name_filefile(search_name.txt)是调用名为search_name.txt的文档while True:               #进入循环line  name_file.readline()           #以行的形式读取search_name.txt文档信息if len(line)  0:      #当len(name_file.readline() )为0时表示读完了文件len(name_file.readline() )为每一行的字符长度空行的内容为\n也是有两个字符。len为0时进入循环break       #执行到这里跳出循环if input in line:    #如果输入的input信息可以匹配到文件的某一行进入循环print Match item: %s  %line     #输出匹配到的行信息match  1    #给变量match赋值为1if match  0 :              #如果match等于0则进入   print No match item found!         #输出提示信息else: print Sorry ,user  %s not found  %input      #如果输入的用户不是wenlong则输出信息没有这个用户上面加了备注的脚本也可以直接使用这里重新贴一次没有注释的供学习#!/usr/bin/pythonwhile True:input  raw_input(Please input your username:)if input  wenlong:password  raw_input(Please input your pass:)p  123while password ! p:password  raw_input(Please input your pass again:)if password  p:print welcome to select system!while True:match  0input  raw_input(Please input the name whom you want to search :)while not input.strip():print No match item found!input  raw_input(Please input the name whom you want to search :)name_file  file(search_name.txt)while True:line  name_file.readline()if len(line)  0:breakif input in line:print Match item:   , linematch  1if match  0 :print No match item found!else: print Sorry ,user  %s not found  %input测试图片