真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

python學(xué)習(xí)之工資結(jié)算

import os,re,sys

創(chuàng)新互聯(lián)建站專注于固原網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供固原營銷型網(wǎng)站建設(shè),固原網(wǎng)站制作、固原網(wǎng)頁設(shè)計(jì)、固原網(wǎng)站官網(wǎng)定制、成都微信小程序服務(wù),打造固原網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供固原網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

operation_lists = '''
1.查詢工資
2.修改工資
3.增加新員工記錄
4.刪除員工信息
5.退出
'''
user_dict = {}
user_name = []

def user_information():
with open('info.txt','r',encoding='UTF-8') as f :
f = f.readlines()
for i in f:
i = i.strip()
i = i.split()
global user_name
user_name.append(i[0])
user_dict[i[0]] = i[1]
print(user_name)

def operation():
while True:
print(operation_lists)
user_operation = input('請(qǐng)輸入你的操作編號(hào):')
if user_operation.isdigit():
user_operation = int(user_operation)
if user_operation > 5:
print('你在搞什么,不要亂搞')
if user_operation == 1:
user_enquires()
if user_operation == 2:
salary_change()
if user_operation == 3:
add_users()
if user_operation == 4:
del_users()
if user_operation == 5:
sys.exit('退出程序')
else:
print('不要搞事情')

def user_enquires():
user_information()
name_key = input('輸入你想查詢?nèi)藛T的名字:')
global user_dict
print('%s的工資為%s'%(name_key,user_dict.get(name_key)))

def salary_change():
user_information()
name_key = input('輸入你想改變?nèi)藛T工資的名字:')
print('%s的工資為%s' % (name_key, user_dict.get(name_key)))
salary_change = input('請(qǐng)輸入該員工新的金額:')
if salary_change.isdigit():
salary_change = int(salary_change)

    with open('info.txt','r',encoding='UTF-8') as fa :
       lines = fa.readlines()
    with open('info.txt','w',encoding='UTF-8') as f_w:
        for line in lines:
            if name_key in line:
                name_salay = str(user_dict.get(name_key))
                print(name_salay)
                salary_change = str(salary_change)
                line = line.replace(name_salay,salary_change)
            f_w.write(line)
        user_dict[name_key] = salary_change
        print(user_dict)
else:
    print('能不能不搞事????')

def add_users():
user_information()
user_name = input('請(qǐng)輸入你要添加人員的姓名:')
user_salary = input('請(qǐng)你給他開工資:')
if user_salary.isdigit():
user_salary = int(user_salary)
else:
print('能不能不搞事??!')
user_dict[user_name] = user_salary

def del_users():
user_information()
user_name = input('請(qǐng)輸入你要?jiǎng)h除員工的姓名:')
user_dict.pop(user_name)

operation()
#user_information()
#user_enquires()
#salary_change()
#add_users()

#user_information()


網(wǎng)站標(biāo)題:python學(xué)習(xí)之工資結(jié)算
鏈接地址:http://weahome.cn/article/pshpph.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部