pwd

springboot入门

时光毁灭记忆、已成空白 提交于 2019-12-05 12:01:53
Springboot入门 Spring Boot它本身并不提供Spring框架的核心特性以及扩展功能,只是用于快速、敏捷地开发新一代基于Spring框架的应用程序。也就是说,它并不是用来替代Spring的解决方案,而是和Spring框架紧密结合用于 提升 Spring开发者体验 的工具 同时它集成了大量常用的第三方库配置(例如Jackson, JDBC, Mongo, Redis, Mail等等),Spring Boot应用中这些第三方库几乎可以 零配置 的开箱即用( out-of-the-box),大部分的Spring Boot应用都只需要非常 少量 的配置代码,开发者能够更加专注于业务逻辑 注 1:敏捷式开发 注2:spring boot其实不是什么新的框架,它默认配置了很多框架的使用方式, 就像maven整合了所有的jar包,spring boot整合了所有的框架 Idea配置SpringBoot项目 java源文件夹中的Springboot01Application.java是整个项目的启动类 static:存放的是静态资源的文件 templetes:存放的项目所需的页面 application.properties里面存放的是项目的全局配置信息 启动Springboot 浏览器访问 测试springboot(案例) 1 package com.javaxl

How to shadow python builtin pwd module

北城余情 提交于 2019-12-05 10:24:38
There is some python code that works under Linux. It uses the pwd module in a way like that: import pwd ... def func(): user=pwd.getpwnam(user)[2] Now we have a specific need to cover this code with tests, and tests have to be runnable under Windows. The program itself is intended to run only under Linux. The problem is that pwd module is not available under Windows, so the code under test will fail with ImportError, even if the implementation of pwd functions is mocked using MagicMock. The basic idea to solve this issue was to shadow the pwd module when running tests. So when running tests,

11月19日 数据库连接 PDO

江枫思渺然 提交于 2019-12-05 09:36:01
PDO: <?php /*$conn = mysql_connect('localhost','root','root'); mysql_select_db('db_shcool'); $result = mysql_query ('select*from stu2');*/ //print_r(mysql_fetch_array($result)); //print_r(mysql_fetch_array($result)); //mysql_close($conn); /*while ($row = mysql_fetch_array($result)){ print_r($row);*/ /*$row=mysql_fetch_array($result); while($row){ print_r($row); $row=mysql_fetch_array($result); }*/ $dsn = 'mysql:host=localhost;dbname=db_shcool'; $opt = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8'); $user = 'root'; $pwd = 'root'; $pdo = new PDO ($dsn, $user, $pwd,$opt); $rs = $pdo ->

Djangorestframework

非 Y 不嫁゛ 提交于 2019-12-05 09:16:31
序列化 验证 解析器 授权和权限 版本控制 分页 视图和路由 访问频率 djangorestframework模块为django提供了restful接口 安装 : pip install djangorestframework     django settings.py INSTALLED_APPS 中加入 " rest_framework " 序列化 序列化是该模块的最基本功能,能够将表数据,转换为json字典以及json字符串 形式1 from rest_framework import serializers class UserSerializer(serializers.Serializer): ut_title = serializers.CharField(source='ut.title') user = serializers.CharField(min_length=6) pwd = serializers.CharField(error_messages={'required': '密码不能为空'}, validators=[PasswordValidator()])   x1 = serializers.CharField(source='group.mu.name') # 多对一或一对一跨表查询 def create(self, validated

python学习-day2 python数据类型

大兔子大兔子 提交于 2019-12-05 06:21:55
day1知识回顾: postman自动化 1.参数文件,username和password value 中做成参数{username} {password} 2.Tests中检查点 3.Runner中设置循环次数,选择参数文件 day1作业 import datetime today = datetime.datetime.today() user = 'cheery' for i in range(3): username = input('username:').strip() password = input('password:').strip() if username =='' or password =='': print('账号/密码不能为空!') elif username.lower()==user.lower() and password='123456': print('登陆成功,欢迎%s登陆,今天的日期是%s'%(username,today)) else: print('账号/密码错误!') else: print('登陆次数过多,请稍后再试!') #写一个随机产生138开头的手机号的程序 #1.输入一个数量,产生XX条手机号 prefix='138'138+randint(100000000,99999999) #2.产生的这些手机号不能重复

数据仓库001 - 复习Linux shell命令 - 01

核能气质少年 提交于 2019-12-05 05:27:46
1. [root@localhost ~]# 的含义 ?    【登录的用户 机器的名称 家目录】 2. 查看当前光标所在的目录 pwd [root@localhost ~]# pwd /root 3. 切换目录 cd [root@localhost ~]# cd /home [root@localhost home]# pwd /home   root用户 家目录 /root 规定   xxx用户 家目录 /home/xxx 默认 回退家目录 的三种方法: [root@localhost home]# cd - /root [root@localhost ~]# cd /home [root@localhost home]# cd ~ [root@localhost ~]# cd /home [root@localhost home]# cd /root [root@localhost ~]# cd ../ 回退上一层目录 cd ../../ 回退上2层目录 [root@localhost ~]# cd /home/linux/ [root@localhost linux]# pwd /home/linux [root@localhost linux]# cd ../ [root@localhost home]# pwd /home [root@localhost home]#

面向过程编程

主宰稳场 提交于 2019-12-04 15:34:14
面向过程编程 面向过程编程是解决问题的一种思想,相当于武林门派,武林门派之间没有好坏之分,因此它与我们之后学习的面向对象编程其实没有好坏之分。 面向过程编程,核心是编程二字,过程指的是解决问题的步骤,即先干什么、后干什么、再干什么、然后干什么…… 基于该思想编写程序就好比在设计一条流水线,面向对称编程其实是一种机械式的思维方式。 当我们写登录功能,我们首先需要输入账号、密码,然后认证两次密码是否相同,然后从数据库中读取密码验证用户密码输入是否正确,然后输入验证码……之后,我们就能够实现登录功能。这样把登录功能问题流程化,进而是解决问题的思路非常清晰。 优点:复杂的问题流程化,进而简单化。 生产汽水瓶的流水线,没办法生产特斯拉。流水线下一个阶段的输入与上一个阶段的输出是有关联的。因此他的扩展性极差。 缺点:扩展性差。 一、注册功能 1.1 接受用户输入用户名,进行合法性校验,拿到合法的用户名 def check_username(): username = input('username>>>').strip() if username.isalpha(): return username else: print('用户名必须为字母,傻叉') 1.2 接受用户输入密码,进行合法性校验,拿到合法的密码 def check_pwd(): while True: pwd = input(

面向编程

孤街醉人 提交于 2019-12-04 13:33:11
面向编程 面向编程是一门编程思想 面向 过程 编程 ​ 核心 是 ’过程‘ 二字,过程指的是一种解决问题的步骤,即先干什么再干什么 ​ 基于该编程思想编写程序时,就好比在设计一条工厂流水线 优点:将复杂问题简单化 缺点:可扩展性差 案例:登录注册功能 1.设计先让用户输入用户名和密码,校验合法性,得到合法的用户名与密码 ​ user, pwd, =get_user_pwd() 2.设计字符串的拼接,得到拼接好的字符串 user_pwd_srt = cut_user_pwd() 3.开始写文件 save_data(user_pwd_str) #1、设计先让用户输入用户名密码,校验合法性,得到合法的用户名与密码 def get_user_pwd(): while True: #让用户输入用户名与密码 username = input('请输入用户名:').strip() #校验用户名是否合法 str.isalpha 校验英文字母、字母 if username.isalpha(): break else: print('用户名不合法') while True: password = input('请输入密码:').strip() re_password = input('请确认密码:').strip() #校验两次密码是否一致 if password == re_password:

Linux中history历史命令使用方法详解

本秂侑毒 提交于 2019-12-04 12:53:07
注意:上下箭头按键本身就可以访问到历史的命令信息 当你在玩Linux的时候,如果你经常使用命令行来控制你的Linux系统,那么有效地使用命令历史机制将会使效率获得极大提升。一旦掌握了下面给出的15个有关Linux history历史命令的例子,你就会发现使用history历史命令行将更有乐趣。 1、使用HISTTIMEFORMAT在历史中显示TIMESTAMP 通常情况下,当你在命令行中键入history时,终端中将显示你刚输入的命令及其编号。如果出于审查命令的目的,和命令一起显示时间戳将会很有帮助,如下所示。 # export HISTTIMEFORMAT='%F %T ' # history | more 1 2008-08-05 19:02:39 service network restart 2 2008-08-05 19:02:39 exit 3 2008-08-05 19:02:39 id 4 2008-08-05 19:02:39 cat /etc/redhat-release [注:你也可以设置alias语句来查看最近的历史命令] alias h1='history 10' alias h2='history 20' alias h3='history 30' 2、用Ctrl + R搜索历史命令 方法是:按下Ctrl +R然后输入关键字。

python基础-面向过程编程

笑着哭i 提交于 2019-12-04 12:08:18
面向过程编程 面向过程编程其实是一种 机械式的思维方式 ,其核心就是 "过程" 。 过程指的是 一种解决问题的步骤 ,即先干什么再干什么,最后干什么。 优点 :将复杂的问题流程化,进而简单化。 哈哈哈哈,这种时刻,话不多说,上代码! # 需求:实现一个注册功能 def user_pwd_auth(): """ 检验用户名、密码的合法性 :return: 合法的用户名、密码 """ while True: username = input("请输入用户名>>>:") if username.isalpha(): break else: print("您输入的用户名不合法!") while True: password = input("请输入密码>>>:") re_pwd = input("请输入确认密码>>>:") if password == re_pwd: break else: print("密码和确认密码不一致!") return username, password def cut_user_pwd(username, pwd): """ 拼接用户名和密码,返回一个字符串 :param username: 用户名 :param pwd: 密码 :return: 字符串 """ return f"{username}|{pwd}\n" def save_user