option

python:利用configparser模块读写配置文件

我们两清 提交于 2019-12-02 14:55:19
Copy from : https://www.cnblogs.com/imyalost/p/8857896.html 在自动化测试过程中,为了提高脚本的可读性和降低维护成本,将一些通用信息写入配置文件,将重复使用的方法写成公共模块进行封装,使用时候直接调用即可。 这篇博客,介绍下python中利用configparser模块读写配置文件的方法,仅供参考。。。 一、读取文件 configparser模块支持读取 .con f和 .ini 等类型的文件,那么首先在文件夹新建一个.ini文件,写入一些信息,如下图: 示例代码如下: 1 # coding=utf-8 2 import configparser 3 import os 4 5 os.chdir("E:\\Automation\\UI\\testcase") 6 cf = configparser.ConfigParser() 7 8 # read(filename) 读文件内容 9 filename = cf.read("test.ini") 10 print(filename) 11 12 # sections() 得到所有的section,以列表形式返回 13 sec = cf.sections() 14 print(sec) 15 16 # options(section) 得到section下的所有option

What can cause a CMake option not work?

安稳与你 提交于 2019-12-02 13:30:15
问题 I am preparing an application which should work with and without GUI, so I use in my CMakeLists.txt the command option (NEED_GUI "Include Qt support" OFF) and if (NEED_GUI) message("****GUI should be OFF****") add_subdirectory(QtGUI) # The Qt-based graphics routines endif (NEED_GUI) Despite that I set the option OFF, I receive the message and the library is built. Where to look for an error? 回答1: Turning my comment into an answer Your code looks good. So I'm assuming the problem here is that

手机滑动touchSwipe

非 Y 不嫁゛ 提交于 2019-12-02 13:28:48
jQuery.touchswipe插件 TouchSwipe一款专门为移动设备设计的jquery插件,用于监听单个和多个手指触摸等事件。 一、特点: 1、监听滑动的4个方向:上、下、左、右; 2、监听多个手指收缩还是外张; 3、支持单手指或双手指触摸事件; 4、支持单击事件touchSwipe对象和它的子对象; 5、可定义临界值和最大时间来判断手势的实际滑动; 6、滑动事件有4个触发点:“开始”,“移动”,“结束”和“取消”; 7、结束事件可以在触摸释放或是达到临界值时触发; 8、允许手指刷和页面滚屏; 9、可禁止用户通过输入元素(如:按钮、表单、文本框等)触发事件; 二、安装 1、NPM npm install jquery-touchswipe --save 2、Bower bower install jquery-touchswipe --save 3、将压缩文件添加到你的项目里 <script src="js/jquery.touchSwipe.min.js" type="text/javascript"></script> 4、使用 1 2 3 4 5 6 7 8 9 10 11 $( function () { $( "#test" ).swipe( { //Generic swipe handler for all directions swipe: function

thinkphp 二级域名绑定模块,导致设置的路由被多域名共用的问题解决方案

ε祈祈猫儿з 提交于 2019-12-02 12:53:00
问题背景: 在router.php路由配置文件设置了二级域名和路由设置 use think\Route; Route::domain('www','index'); Route::domain('admin','admin'); Route::domain('m','m'); Route::rule('show/:id','index/Article/item'); Route::rule('about_us','index/index/about_us'); 遇到的问题: 访问 www.t.com/about_us 会访问 index/index/about_us 即index模块index控制器的about_us方法; 但是 访问 admin.t.com/about_us 也会访问 index/index/about_us ;这显然是我们不想看到的 解决思路: 能不能在Route的rule()中做一个判断?如果当前域名是绑定了admin模块的,但是设置的路由地址(即:index/index/about_us) 的模块不是admin模块,那么就忽略该路由设置 修改源码: /** * 注册路由规则 * @access public * @param string|array $rule 路由规则 * @param string $route 路由地址 * @param string

系统管理工具

半世苍凉 提交于 2019-12-02 12:29:35
系统管理工具 进程分类 cpu-bound:cpu密集型非交互 io-bound:io密集型交互 系统状态查看以及管理工具 pstree ps pgrep 系统工具uptime pidof top/htop free/glance pmanp vmstat dstat pstree 显示进程树 pstree [option] 参数 -a:显示每个程序的完整指令,包含路径,参数或是常驻服务的标示; -c:不使用精简标示法; -G:使用VT100终端机的列绘图字符; -h:列出树状图时,特别标明现在执行的程序; -H:此参数的效果和指定"-h"参数类似,但特别标明指定的程序; -l:采用长列格式显示树状图; -n:用程序识别码排序。预设是以程序名称来排序; -p:显示程序识别码; -u:显示用户名称; -U:使用UTF-8列绘图字符; -V:显示版本信息。 ps 过程状态,显示当前进程快照 ps [option] 参数 Option: a显示所有终端的进程 x不链接终端的进程 u显示所有者的进程 f选项显示进程的树 k 对属性排序,-属性则会倒序排序该属性 o 定制显示属性信息属性之间用逗号分隔 l 显示能够显示的所有属性 -C 显示指定命令,多个命令逗号分隔 -L显示线程 -e显示所有进程 -f显示完整的程序格式信息 -F显示完成的进程信息 -u指定有效用户id -U真正用户id

表单输入绑定(二)

柔情痞子 提交于 2019-12-02 11:09:49
1.选择框 用 v-for 渲染的动态选项: <select v-model="selected"> <option v-for="option in options" v-bind:value="option.value"> {{ option.text }} </option> </select> <span>Selected: {{ selected }}</span> new Vue({ el: '...', data: { selected: 'A', options: [ { text: 'One', value: 'A' }, { text: 'Two', value: 'B' }, { text: 'Three', value: 'C' } ] } }) 2.值绑定 把值绑定到 Vue 实例的一个动态属性上,可以用 v-bind 实现,并且这个属性的值可以不是字符串 复选框 <input type="checkbox" v-model="toggle" true-value="yes" false-value="no" > // 当选中时 vm.toggle === 'yes' // 当没有选中时 vm.toggle === 'no' 单选按钮 <input type="radio" v-model="pick" v-bind:value="a"> // 当选中时

jquery 对select中的option操作

旧城冷巷雨未停 提交于 2019-12-02 07:21:48
Jquery的功能很强大,下面介绍Jquery操作表单Select元素的用法: jQuery获取Select元素,并选择的Text和Value: 1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text 3. var checkValue=$("#select_id").val(); //获取Select选择的Value 4. var checkIndex=$("#select_id ").get(0).selectedIndex; //获取Select选择的索引值 5. var maxIndex=$("#select_id option:last").attr("index"); //获取Select最大的索引值 jQuery获取Select元素,并设置的 Text和Value: 实例分析: 1. $("#select_id ").get(0).selectedIndex=1; //设置Select索引值为1的项选中 2. $("#select_id ").val(4); // 设置Select的Value值为4的项选中 3.

浅谈jquery关于select框的取值和赋值

拜拜、爱过 提交于 2019-12-02 07:21:35
jQuery("#select_id").change(function(){}); // 1.为Select添加事件,当选择其中一项时触发 var checkValue = jQuery("#select_id").val(); // 2.获取Select选中项的Value var checkText = jQuery("#select_id :selected").text(); // 3.获取Select选中项的Text var checkIndex = jQuery("#select_id").attr("selectedIndex");// 4.获取Select选中项的索引值, 或者:jQuery("#select_id").get(0).selectedIndex; var maxIndex = jQuery("#select_id :last").attr("index"); // 5.获取Select最大的索引值, 或者:jQuery("#select_id :last").get(0).index; jQuery("#select_id").get(0).selectedIndex = 1; // 1.设置Select索引值为1的项选中 jQuery("#select_id").val(4); // 2.设置Select的Value值为4的项选中 $("

jQuery radio取值,checkbox取值,select取值

泪湿孤枕 提交于 2019-12-02 07:21:23
语法解释: 1 $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2 var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text 3 var checkValue=$("#select_id").val(); //获取Select选择的Value 4 var checkIndex=$("#select_id ").get(0).selectedIndex; //获取Select选择的索引值 5 var maxIndex=$("#select_id option:last").attr("index"); //获取Select最大的索引值 jQuery设置Select选择的Text和Value: 语法解释: 1 $("#select_id ").get(0).selectedIndex=1; //设置Select索引值为1的项选中 2 $("#select_id ").val(4); //设置Select的Value值为4的项选中 3 $("#select_id option[text='jQuery']").attr("selected", true); /

CSS with Option tag - Editing text color

点点圈 提交于 2019-12-02 06:34:14
Is there any secret behind editing a option tag with css? I just can't solve this issue <option> FirstName <span class = "foo">SecondName</span> </option> .foo{ color:#666666; } What am I missing? <option> elements cannot contain anything other than text . So no, you can't apply a style to a section of their content. Just don't use a <select> , or don't bother about styling. From your use case, it doesn't really look suitable anyway. It'd be better just to type the name, wouldn't it? I know this question is old, but there are some new developments in the world of CSS! color property on select