前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >大佬的测试笔记

大佬的测试笔记

作者头像
我去热饭
发布2022-05-18 21:12:10
3100
发布2022-05-18 21:12:10
举报
文章被收录于专栏:测试开发干货测试开发干货

整理多位测开大佬累计多年的私人笔记。隆重公布

python数据类型转化

配置文件相关:

import configparser

cfp = configparser.ConfigParser()

cfp.read("test.ini")

'''获取所有的selections'''

selections = cfp.sections()

print(selections) # ['Title1', 'Title2']

'''获取指定selections下的所有options'''

options = cfp.options("Title1")

print(options) # ['key1', 'key2']

'''获取指定selection下的指定option的值'''

value= cfp.get("Title1", "key1")

print(value) # 1111111111

'''判断是否含有指定selection 或 option'''

print(cfp.has_section("Title1")) # True

print(cfp.has_option("Title1", "key3")) # False

import configparser

cfp = configparser.ConfigParser()

cfp.read("test.ini")

cfp.add_section("Title3") # 设置option的值

cfp.set("Title3", "key1", "1111111111") # 注意这里的selection一定要先存在!

cfp.set("Title3", "key2", "2222222222")

cfp.remove_section("Title3") # 移除指定selection

cfp.remove_option("Title2", "key1") # 移除指定selection下的option

with open("test.ini", "w+") as f:

cfp.write(f)

django相关:

sqlite3 xxx

.tables

select * from 表;

update 表 set xx=xx where xx=xx

服务器拉代码部署django

git fetch --all

git reset --hard origin/master

find . | xargs grep link-off 查找带任何字符串的文件

json.dumps(d, ensure_ascii=False, encoding='utf-8'))

cat ~/.gitconfig | head -10 查看git用户名等

ps -ef | grep Monitor | grep -v grep | awk '{print $2}' | xargs kill -9 按照进程名杀死进程

git push origin master:test -f

Django 查询filter 常见查询方法

  • __exact 精确等于 like 'aaa'
  • __iexact 精确等于 忽略大小写 ilike 'aaa'
  • __contains 包含 like '%aaa%'
  • __icontains 包含 忽略大小写 ilike '%aaa%',
  • __gt 大于
  • __gte 大于等于
  • __lt 小于
  • __lte 小于等于
  • __in 存在于一个list范围内
  • __startswith 以...开头
  • __istartswith 以...开头 忽略大小写
  • __endswith 以...结尾
  • __iendswith 以...结尾,忽略大小写
  • __range 在...范围内
  • __year 日期字段的年份
  • __month 日期字段的月份
  • __day 日期字段的日
  • __isnull=True/False 判断某字段是否为空
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-02-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 测试开发干货 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档