分类 perl/php/python/gawk/sed articles

python基础(一)字符串string

一、python string 概述 string在任何大部分编程语言里都是一个基础组成部分,python也不例外 。python 语言中同时还有一个string模块,该模快在python的发展中已经经历了一个历史轮回。在最开始的时候,python有一个专门的string的module,要使用str……

Continue reading

理解Python的With语句

一、with语句是什么? Python’s with statement provides a very convenient way of dealing with the situation where you have to do a setup and teardown to make something happen. A very good example for this is the situation where you want to gain a handler to a file, read data from the file and the close the file handler. 有一些任务,可能事先需要设置,事后做清理工作。对于这种场景,Python的with语句提供了一种非常方便的处理方式。一个很好的例子……

Continue reading

python之raw_input和input

在使用python编写交互式程序时,经常用到的两个内部函数是raw_input和input(最常用还是input) ,本篇就通过一些示例看下两者之间的区别 。 一、raw_input 1.输入字符串 1nID = '' 2while 1: 3 nID = raw_input("Input your id plz") 4 if len(nID) != len("yang"): 5 print 'wring length of id,input again' 6 else: 7 break 8print 'your id is %s' % (nID) 2.输入整数 1nAge = int(raw_input("input your……

Continue reading

理解 Python 中的多线程及资源竞争

本篇是从网上摘来的一个老外写的一篇文章的译文,主要通过几个示例来了解python 的线程及如何避免线程之间的竞争。 当然在提到python的多线程问题时,很多人会提到GIL的问题,不过本篇要展示的内容不做GIL的讨论。 一、单线程请求与多线程请求 例1:单线程请求 1#!/usr/bin/env python 2import time 3import urllib2 4def get_responses(): 5 urls = [……

Continue reading

PHP添加MongoDB扩展

由于要使用mikoomi mongodb plugin插件,所以需要php对mongodb的扩展支持,默认通过源安装的php并没有mongodb的扩展支持,具体可以通过php -m|grep mongo 验证 。这里就结合phpize提供的动态扩展功能进行mongodb的扩展。 一、php mongo模块的编译 先从 http://pecl.php.net/package/mongo 下载目前的……

Continue reading

python+tornado实现微信公众平台与服务器交互

在写完 监控自动化碎碎念 后 ,在网上有找手机APP平台与服务器进行交互的相关资料 。而目前使用人数较多的手机APP里 ,同时官方提供API较好的只有微信和易信 。易信的相关资料相对少些,毕竟平台没有微信大 。在查找通过微信与服务器之间进行交互时,有幸看到了如下的一篇内容,现摘录过来。 具体实现……

Continue reading

基于Sublime Text搭建Python IDE

说起编辑器,可能大部分人要推荐的是Vim和Emacs,本人用过Vim,功能确实强大,但是不是很习惯,之前一直有朋友推荐SUblime Text 2这款编辑器,然后这段时间就试了一下,就深深地喜欢上这款编辑器了,对于类似的编辑器,我用过notepad2、notepad++、Editplus、……

Continue reading

编写变态的PHP后门

在这篇文章中,我将向大家介绍如何编写一个非字母数字的PHP后门。在编写这种PHP后门的时候,我们首先需要了解一些基础知识: (1)了解PHP (2)了解curl或者其他一些能够操作HTTP请求的工具 还有一点需要大家了解的是PHP中异或(^)的概念。对于异或,大家肯定都有所了解,但是平……

Continue reading

自建KVM模板

这两天一直计划写一个通过模板img和xml文件实现KVM的快速部署的脚本 ,实现原理非常简单,就是通过复制img镜像到指定位置,并修改xml里的相关配置后,define guest主机,最后start即可。后来在网上也找了两个实现类似功能的脚本 ,一个是shell版的,一个是pytho……

Continue reading

Python HTMLParser处理HTML转义字符

抓网页数据经常遇到例如>或者 这种HTML转义符,抓到字符串里很是烦人。比方说一个从网页中抓到的字符串: 1html = '<abc>' 用Python可以这样处理: 1import HTMLParser 2html_parser = HTMLParser.HTMLParser() 3txt = html_parser.unescape(html) #这样就得到了txt = '<abc>' 如果还想转回去,可以这样: 1import cgi 2html = cgi.escape(txt) # 这样又回到了 html = '<abc>'……

Continue reading

Latest articles

Categories

Tags

ACL AD AES AI AWS Ansible Atlassian Azure BMC Blockchain Brocade CDH5 CL210 Cobbler Confd C语言 DDOS DISTINCT DNS Duckdb EKS ELK GCP Ghost Git Glusterfs Go Godaddy Grafana HBA HCIE Hotspot HttpWatch IBM IIS IOS InfluxDB Ingress InnoDB JavaScript Jinja2 KVM Keepalived Mplayer MySQLdb Netlify OpenResty PM PostgreSQL QoS RH318 RH442 RHCA RHCE RHEV RSA SRE SecureCRT Statuscode SublimeText2 TC Telecom Tencentcloud VBA aira2 alpine android anpic apache apm apparmor appfog apr apt-get aria2 array atop audit awk awstats axel backdoor backup bamboo bash bat benchmark bigdata bin bind bitwise book bootstrap bsd c1000 cache capistrano catlog centos centos7 chatops chattr check_mk checkinstall cisco clearall clickhouse cloud-desktop cmdb cms collectd comm compress conver corosync cpu crontab crunchbang css curl date decode dell desktop devops df dhcp diff diskpart django docker dos2unix dpkg drupal etcd excel fail2ban fastcgi fdisk fiddler find firewalld flask flvtool ftp function fuser geek gin github gitlab glances golang google gooupadd graphviz gravatra grep grub2 hadoop haproxy hardware heartbeat helm hexdump hhvm history html http/html/web httplogs https huawei huaweicloud hugo icmp iconv ifconfig inotify iopp ipmitool iptables iredmail iscsi isito it-news java jdk jenkins jira join joomla k3s k8s kdump kernel kingate lamp last leetcode lib light-http linux linux高级篇 ln ls lsi lsof lvm lvs mac mail man mark markdown matplotlib maven memcached microservice mimikatz mkdocs mkpasswd mmonit mod_jk mongodb monit monitor mono moodle mosh mount mpm mrtg mtr my.cnf mysql mysqlbinlog mysqld_multi mysqldump mysqlhotcopy nagios nc nethogs nexus nfs nginx nmon nocatlog node.js nrpe ntfs ntop ntp obs ocr open-falcon openbox opencv openldap openssl openstack oracle oswatch paas pacemaker pam pandas parted pcp pcre pdf percona perl pexpect pgrep php php-fpm ping plsql develope postfix powershell prettify proc prometheus puppeteer pushd pwgen pxe pyecharts python python模块 radmin raid rdesktop read redhat redis redmine regex rh134 rhel7 rhel8 rm rman rootkit route rpm rpmforge rrdtool rsync rsyslog safe saltstack samba scapy screen sed selenium selinux seo seq session set shc sheepdog shell shopt sitemap skydns smokeping snffier snmp socket soft sort spider sql sqlserver squid ss ssh sshpass strace strings su sudo suse svn sysbench syslog-ng sysstat systemd t tar tcpcopy tcpdump tech telnet tengine test testlink threads time tmux tomcat touch tr tsar twisted ubuntu udev ulimit unix unixbench user-agent useradd varnish vbs vercel vi vim visudo vmstat vmware vnc voice vpn vscode vsftp vsftpd vue watchdog web webcam webistrano wget wiki windows wol wordpress workshop wsl x-windows xampp xcache xmllint xtrabackup yule yum zabbix zeromq zip zonetime zookeeper 下载工具 云主机 云原生 代理 加密 古意 吐槽 圈里圈外 娱乐 字符串函数 安全 平台架构 意林 推理 提权 故事汇 故障案例 数据结构 每日看点 民国史 生活 科学记录 站长管理工具 算法 管理 网站架构 翻墙 股票 行业 诗韵 负载均衡 远程管理 面试题

Links

Meta