码迷,mamicode.com
首页 >  
搜索关键字:print    ( 43532个结果
Valid Phone Numbers
Given a text filefile.txtthat contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers.You may as...
分类:其他好文   时间:2015-05-07 23:26:13    阅读次数:158
Python 3.x中使用print函数出现语法错误(SyntaxError: invalid syntax)的原因
在安装了最新版本的Python 3.x版本之后,去参考别人的代码(基于Python 2.x写的教程),去利用print函数,打印输出内容时,结果却遇到print函数的语法错误:SyntaxError: invalid syntax这是因为Python 2.x升级到Python 3.x,print函数的语法变化了,所以用Python 2.x的print函数的代码,放在Python 3.x中运行,结果就...
分类:编程语言   时间:2015-05-07 22:08:54    阅读次数:183
使用 core dump 查找程序遇到严重问题退出的原因
不使用 ulimit 命令,在程序中使用 API 开启 core dump。注意:只对当前程序有效。#include int enableCoreDump(void){ struct rlimit r_old, r_new; getrlimit(RLIMIT_CORE, &r_old); print...
分类:其他好文   时间:2015-05-07 20:17:29    阅读次数:143
nagios监控redis端口、监控url接口告警脚本
监控redis端口如下:#!/bin/sh#Createdbyhys20140823declare-amaster_ismaster_is=($(redis-cli-h192.168.0.76-p7711INFO|greprole|awk-F:‘{print$2}‘))echo$master_isif[${master_is}=="master"];thenecho"OK-slaveisrunning"exit0elseecho"Critical-slaveiserror"exit2fi监控..
分类:移动开发   时间:2015-05-07 17:06:06    阅读次数:136
kill掉tomcat进程并重启服务
#!/bin/shecho"kill-9`psaux|grepjava|grep[t]omcat01|awk‘{print$2}‘`"psaux|grepjava|grep[t]omcat01|awk‘{print$2}‘|xargskill-9echo"kill-9`psaux|grepjava|grep[t]omcat02|awk‘{print$2}‘`"psaux|grepjava|grep[t]omcat02|awk‘{print$2}‘|xargskill-9/data/webserver/tomc..
分类:系统相关   时间:2015-05-07 16:59:39    阅读次数:155
win7 安装 ubuntu 12.04 不识别分区
电脑上原来有个win7, 由于要在 ubuntu 环境下开发, 所以要装个 ubuntu 。 在 win7 下, 通过压缩卷, 腾出来了 150G 的空间。 安装 ubuntu 的时候, 提示说我电脑上没有操作系统。 选择分区的地方, 看到的只有整个硬盘设备, 看不到硬盘上的分区。   网上找了些资料, 通过命令: sudo parted /dev/sda 进去后, 输入 print...
分类:Windows程序   时间:2015-05-07 16:51:05    阅读次数:173
gdb学习(二)
?? 查看运行时数据 print - 查看变量值   ptype – 查看变量类型 #ptype i #ptype “aaa” 打印字符串”aaa”的类型 #ptype array 打印数组array的类型 #ptype main 打印main函数的类型   print array – 查看数组 #p arr1 #p arr1[2] 查看数组arr2第三个元素值 #p...
分类:数据库   时间:2015-05-07 14:35:46    阅读次数:255
字符串操作函数5!!
1、addslashes() 在预定义字符串前添加反斜杠 magic_quotes_gpc=on 对get/post提交的数据自动转义 get_magic_quotes_gpc() 获取php是否开启自动转义 stripslashes() 吧转义字符前反斜杠删除 print_r(ini_get_al...
分类:其他好文   时间:2015-05-07 14:21:58    阅读次数:101
web日志分析脚本nginx&http
1,http日志分析#!/bin/bash foriin$@;do echo====================="$i"=============================>>weblog.txt echo"IPdata">>weblog.txt awk‘{print$1}‘$i|wc-l>>weblog.txt awk‘{print$1}‘$i|sort|uniq-c|wc-l>>weblog.txt echo"sokectdata"&g..
分类:Web程序   时间:2015-05-07 12:39:34    阅读次数:156
python14:错误和异常
在编程的过程中,总是无法避免处理异常的情况,这些异常也有可能是错误,也有可能是一些偶现的异常,Python中提供了处理这些情况的有效机制。 语法错误 语法错误,即解析错误,也许会是你学习Python的过程中遇到最多的错误: >>> while True print('Hello world') File "", line 1, in ? while True print('Hel...
分类:编程语言   时间:2015-05-07 12:36:26    阅读次数:123
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!