这是最后一条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. 通过 bsondump 命令工具 解析备份产生的bson文件

    bsondump命令是将BSON格式的文件转换为可读性更强的文件格式,例如转为为JSON 格式的文档,bsondump默认转换为json格式的文档. 当通过mongodump命令进行备份时,如果有参数 ...

  2. 【AI开发】基于深度学习的卡口车型、车牌识别

    服务端代码后面给出 卡口车型.车牌识别demo截图 服务器:

  3. Python 进度条显示

    运行工具:Pycharm, import timescale = 50print("开始执行".center(scale//2,"-")) start = ti ...

  4. shell打印 菱形

    #!/bin/bashread -p "input the length: " n        for i in `seq 1 $n`do    for ((j=$n;j> ...

  5. 【Linux基础】压缩和解压

    Linux 常用的压缩与解压文件类型:.tar,.gz..tar.gz,.bz2..tar.bz2,.Z..tar.Z,.zip,.rar等. Linux 常用的压缩与解压缩命令有:tar,gzip. ...

  6. springboot~@Valid注解对嵌套类型的校验

    @Valid注解可以实现数据的验证,你可以定义实体,在实体的属性上添加校验规则,而在API接收数据时添加@valid关键字,这时你的实体将会开启一个校验的功能,具体的代码如下,是最基本的应用: 实体: ...

  7. .NET Core 使用NLog日志记录

    前言 每个项目都会需要使用到日志功能,这对于项目上线后 出现的bug异常,能及时定位和便于后期错误分析.那我们今天来看看在.NET Core中如何使用NLog日志. NLog 什么是NLog呢? NL ...

  8. vue里如何灵活的绑定class以及内联style

    在我们平常的前端开发中少不了对DOM的操作,以及样式的动态控制,那我们在使用vue的时候该如何灵活的绑定class呢 1.最简单一个class绑定 v-bind:class设置一个对象,可以动态地切换 ...

  9. 遍历 Map 的四种方法

    public static void main(String[] args) { Map<String, String> map = new HashMap<String, Stri ...

  10. SLAM+语音机器人DIY系列:(二)ROS入门——3.在ubuntu16.04中安装ROS kinetic

    摘要 ROS机器人操作系统在机器人应用领域很流行,依托代码开源和模块间协作等特性,给机器人开发者带来了很大的方便.我们的机器人“miiboo”中的大部分程序也采用ROS进行开发,所以本文就重点对ROS ...