L01-04:python Query Employee Information Sheet Practice

Source: Internet
Author: User

#decoding =utf-8

‘‘‘
Write a table of employee information that can be queried by users!
1| user authentication
ID Name Department Phone
Query Keywords: name
‘‘‘

Import linecacheinput01=raw_input ("pls write your name:") I=1name=[]count = Len (open (' User.txt ', ' RU '). ReadLines ())              While i<=count:fline = Linecache.getline ("User.txt", i) Li=fline.split ("", 3) i+=1        Print li[1] Name.append (li[1]) print namefor x in Name:if x=input01:print "it ' s ok!" Break


Feel that the program is relatively dead and has some drawbacks:

1) Independent definition of a name list, wasting memory

2) If judgment, it is best to join the first while loop to get the name field




This article is from the "Emperor Heart Zen Shadow" blog, please be sure to keep this source http://yedee.blog.51cto.com/513852/1548926

L01-04:python Query Employee Information Sheet Practice

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.