这是最后一条NLP了......来吧

十二,动机和情绪总不会错,只是行为没有效果而已

动机在潜意识里,总是正面的。潜意识从来不会伤害自己,只会误会的以为某行为可以满足该动机,而又不知道有其他做法的可能。

情绪总是给我们一份推动力,情绪使我们在该事情之中有所学习,学到了,情绪便会消失。

我们可以接受一个人的动机和情绪,同时不接受他的行为。

接受动机和情绪,便是接受那个人,那个人也会感觉出你对他的接受,因而更肯让你去引导他做出改变。

任何一次行为不等于一个人。

行为不能接受,是因为没有效果,找出更好的做法,是两个人共同的目标,能使两个人有跟好的沟通和关系。

找出更好的做法的方法之一是追查动机背后的价值观。


员工信息表

题目:

接下来是代码了,哇果然是敲着敲着就发现好多以前从来没注意的东西,好多细节。

staff_list文件如下:

1,alex,22,13651054608,IT
2,egon,23,133043202533,teacher
3,nezha,25,1333235322,IT
代码:
 #!usr/bin/env/ python
# -*- coding:utf-8 -*-
# Author: XiaoFeng
import os
li = ["id", "name", "age", "phone", "job"]
flag = False
staff_id = None
number = "xiaofeng"
word = "" def login(func):
def inner():
global flag
if not flag:
print("如想操作员工信息,请先等录:")
account = input("请输入您的账号:").strip()
password = input("请输入您的密码:").strip()
if account == number and password == word:
flag = True
print("登陆成功!")
res = func()
return res
else:
print("账号或密码错误,登陆失败!")
else:
res = func()
return res
return inner def handle(content_1):
if "select" or "set" in content_1 and "where" in content_1:
info_start = content_1.index("t") + 1
info_end = content_1.index("where") - 1
info = content_1[info_start:info_end].strip()
condition = content_1[info_end + 6:].strip()
return info, condition
else:
print("输入错误!") def seek():
content = input("请输入操作:(如select name, age where age>22)").strip().lower()
if content.startswith("select") and "where" in content:
handle_str_1 = handle(content)
out_list = []
for p in li:
if p in handle_str_1[1]:
if ">" in handle_str_1[1]:
info_list = handle_str_1[0].split(",")
str_info = " ".join(info_list)
info_list = str_info.split() # 去字符串内空格
index_0 = handle_str_1[1].index(">")
character = handle_str_1[1][:index_0].strip()
num = handle_str_1[1][index_0 + 1:].strip()
if num.isdigit():
num = int(num)
with open("staff_list", "r", encoding="utf-8") as f:
for line in f:
if not line.isspace():
line_list = line.strip().split(",")
character_value = int(line_list[li.index(character)])
if character_value > num:
if handle_str_1[0].strip() == "*":
out = " ".join(line_list)
print(out)
out_list.clear()
else:
for n in info_list:
out_list.append(line_list[li.index(n)])
out = " ".join(out_list)
print(out)
out_list.clear()
else:
print("请输入数字!")
elif "<" in handle_str_1[1]:
info_list = handle_str_1[0].split(",")
str_info = " ".join(info_list)
info_list = str_info.split()
index_1 = handle_str_1[1].index("<")
character = handle_str_1[1][:index_1].strip()
num = handle_str_1[1][index_1 + 1:].strip()
if num.isdigit():
num = int(num)
with open("staff_list", "r", encoding="utf-8") as f:
for line in f:
if not line.isspace():
line_list = line.strip().split(",")
character_value = int(line_list[li.index(character)])
if character_value < num:
if handle_str_1[0].strip() == "*":
out = " ".join(line_list)
print(out)
out_list.clear()
else:
for n in info_list:
out_list.append(line_list[li.index(n)])
out = " ".join(out_list)
print(out)
out_list.clear()
else:
print("请输入数字!")
elif "=" in handle_str_1[1]:
info_list = handle_str_1[0].split(",")
str_info = " ".join(info_list)
info_list = str_info.split()
index_2 = handle_str_1[1].index("=")
character = handle_str_1[1][:index_2].strip()
num = handle_str_1[1][index_2 + 1:].strip()
if num.isdigit():
num = int(num)
with open("staff_list", "r", encoding="utf-8") as f:
for line in f:
if not line.isspace():
line_list = line.strip().split(",")
character_value = int(line_list[li.index(character)])
if num == character_value:
if handle_str_1[0].strip() == "*":
out = " ".join(line_list)
print(out)
out_list.clear()
else:
for n in info_list:
out_list.append(line_list[li.index(n)])
out = " ".join(out_list)
print(out)
out_list.clear()
else:
with open("staff_list", "r", encoding="utf-8") as f:
for line in f:
if not line.isspace():
line_list = line.strip().split(",")
character_value = line_list[li.index(character)]
if num == character_value:
if handle_str_1[0].strip() == "*":
out = " ".join(line_list)
print(out)
out_list.clear()
else:
for n in info_list:
out_list.append(line_list[li.index(n)])
out = " ".join(out_list)
print(out)
out_list.clear()
elif "like" in handle_str_1[1]:
info_list = handle_str_1[0].split(",")
str_info = " ".join(info_list)
info_list = str_info.split()
index_3 = handle_str_1[1].index("like")
character = handle_str_1[1][:index_3].strip()
num = handle_str_1[1][index_3 + 4:].strip()
with open("staff_list", "r", encoding="utf-8") as f:
for line in f:
if not line.isspace():
line_list = line.strip().split(",")
character_value = line_list[li.index(character)]
if num in character_value:
if handle_str_1[0].strip() == "*":
out = " ".join(line_list)
print(out)
out_list.clear()
else:
for n in info_list:
out_list.append(line_list[li.index(n)])
out = " ".join(out_list)
print(out)
out_list.clear()
else:
print("\033[31;1m您输入的条件不符合规范!\033[0m")
else:
print("请输入正确的操作语句!") @login
def add():
global staff_id
if not staff_id:
if os.path.getsize("staff_list") == 0:
staff_id = 0
else:
d = 0
with open("staff_list", "r", encoding="utf-8") as f:
for line in f:
if not line.isspace():
line_list = line.strip().split(",")
print(line_list)
if line_list[0]:
d = line_list[0]
print(d)
staff_id = int(d)
print("\033[41;1m请按提示输入信息\033[0m".center(39, "*"))
new_staff = []
for a in li[1:]:
staff_info = input("请输入新员工的%s:" % a).strip()
new_staff.append(staff_info)
new_staff_str = ",".join(new_staff)
staff_id += 1
id_str = str(staff_id)
final_str = id_str + "," + new_staff_str + "\n"
with open("staff_list", "a", encoding="utf-8") as f:
f.write(final_str)
print("您添加的信息为:{}".format(final_str)) @login
def delete():
id_delete = input("请输入要删除员工的id号:")
with open("staff_list", "r", encoding="utf-8") as f1, \
open("staff_list_bak", "w", encoding="utf-8") as f2:
for line in f1:
if not line.isspace():
line_list = line.strip().split(",")
if id_delete == line_list[0]:
continue
f2.write(line)
os.remove("staff_list")
os.rename("staff_list_bak", "staff_list")
print("删除成功!") @login
def modify():
content = input("请输入要修改的内容(如set 列名=“新的值” where id=x)").strip()
handle_str = handle(content)
info_list = handle_str[0].split(",")
str_info = " ".join(info_list)
info_list = str_info.split() # 去字符串内空格
index_2 = handle_str[1].index("=")
character = handle_str[1][:index_2].strip()
num = handle_str[1][index_2 + 1:].strip()
if num.isdigit():
num_int = int(num)
with open("staff_list", "r", encoding="utf-8") as f1, \
open("staff_list_bak", "w", encoding="utf-8") as f2:
for line in f1:
if not line.isspace():
line_list = line.strip().split(",")
character_value = int(line_list[li.index(character)])
if num_int == character_value:
for c in info_list:
index_1 = c.index("=")
set_key = c[:index_1].strip()
set_value = c[index_1 + 1:].strip()
line_list[li.index(set_key)] = set_value
line = ",".join(line_list)
f2.write(line)
os.remove("staff_list")
os.rename("staff_list_bak", "staff_list")
else:
print("请输入正确语句!") operate_list = ["查找", "新增", "删除", "修改"]
while True:
print("-" * 50)
for index, i in enumerate(operate_list):
print(index, "\t", i)
choice = input("请输入您个的选择编号:").strip()
if choice.isdigit() and choice == "":
seek()
elif choice.isdigit() and choice == "":
add()
elif choice.isdigit() and choice == "":
delete()
elif choice.isdigit() and choice == "":
modify()
else:
print("请按要求输入编号")

python3 员工信息表的更多相关文章

  1. 无废话ExtJs 入门教程十五[员工信息表Demo:AddUser]

    无废话ExtJs 入门教程十五[员工信息表Demo:AddUser] extjs技术交流,欢迎加群(201926085) 前面我们共介绍过10种表单组件,这些组件是我们在开发过程中最经常用到的,所以一 ...

  2. python-查询员工信息表

    python查询员工信息表 基本要求: 用户可以模糊查询员工信息 显示匹配了多少条,匹配字符需要高亮显示 代码: #!/usr/env python #coding:utf-8 import time ...

  3. python-打印简单公司员工信息表

    python-打印简单公司员工信息表 要求,输入name不为空,输入次数最多3次,3次后跳出程序: 知识点: raw_input str转int whil if elif else continue ...

  4. day12 python作业:员工信息表

    作业要求: 周末大作业:实现员工信息表文件存储格式如下:id,name,age,phone,job1,Alex,22,13651054608,IT2,Egon,23,13304320533,Tearc ...

  5. s9.16作业,员工信息表

    转载https://blog.csdn.net/qq_35883464/article/details/83151464 实现员工信息表文件存储格式如下:id,name,age,phone,job1, ...

  6. python练习题-员工信息表

    周末大作业:实现员工信息表文件存储格式如下:id,name,age,phone,job1,Alex,22,13651054608,IT2,Egon,23,13304320533,Tearcher3,n ...

  7. python基础之员工信息表作业

    周末大礼包 文件存储格式如下: id, name, age, phone, job 1, Alex, 22, 13651054608, IT 2, Egon, 23, 13304320533, Tea ...

  8. python作业员工信息表程序(第四周)

    作业需求: 1. 员工信息表程序,实现增删改查操作: 2. 可进行模糊查询,语法至少支持下面3种: select name,age from staff_table where age > 22 ...

  9. python's sixteenth day for me 员工信息表

    import os user_dic = { 'username':None, 'password':None, 'login':True } flag = False name_list = ['i ...

随机推荐

  1. Android组件化开发的简单应用

    组件化开发的主要步骤: 一.新建Modules 1.新建Project,作为应用的主Module. 2.新建Module:"Common",类型选择"Android Li ...

  2. Windows Server 2012 R2 安装密钥(只适用安装,不支持激活)

    标准版 = NB4WH-BBBYV-3MPPC-9RCMV-46XCB 数据中心版 = BH9T4-4N7CW-67J3M-64J36-WW98Y

  3. 关于项目中ajax 操作 原生项目遇到的问题

    单选框动态赋值 $('input[name=pszt][value='+val+']').attr("checked",true); 置顶的几种方式 window.scrollTo ...

  4. android学习笔记--AlarmManager

    AlarmManager称呼为全局定时器,有的称呼为闹钟.其实它的作用和Timer有点相似. 都有两种相似的用法: (1)在指定时长后执行某项操作(2)周期性的执行某项操作 AlarmManager ...

  5. Django+xadmin打造在线教育平台(一)

    目录 在线教育平台(一)      在线教育平台(二) 在线教育平台(三)      在线教育平台(四) 在线教育平台(五)      在线教育平台(六) 在线教育平台(七)      在线教育平台( ...

  6. qs.stringify和JSON.stringify的使用和区别

    qs可通过npm install qs命令进行安装,是一个npm仓库所管理的包. 而qs.stringify()将对象 序列化成URL的形式,以&进行拼接. JSON是正常类型的JSON,请对 ...

  7. 解读 kubernetes client-go 官方 examples - Part Ⅰ

    目录 1. 介绍 2. 运行测试 2.1 测试环境 2.2 运行结果 3. 原理解析 3.1 获取 kubeconfig 信息,并构造 rest#Config 实例 3.1.1 tools/clien ...

  8. 【转载】java 中变量的存储位置

    原文链接点这里,感谢博主分享 * 寄存器:最快的存储区, 由编译器根据需求进行分配,我们在程序中无法控制. * 栈:存放基本类型的变量数据和对象的引用,但对象本身不存放在栈中,而是存放在堆(new 出 ...

  9. Js-函数式编程

    前言 JavaScript是一门多范式语言,即可使用OOP(面向对象),也可以使用FP(函数式),由于笔者最近在学习React相关的技术栈,想进一步深入了解其思想,所以学习了一些FP相关的知识点,本文 ...

  10. 简单多播委托Demo

    namespace ConsoleApp4 { class Program { static void Main(string[] args) { Mum mum = new Mum(); Dad d ...