Codeforces Round 486 (Div. 3) B. Substrings Sort 题目连接: "http://codeforces.com/contest/988/problem/B" Description You are given n strings. Each string ...
分类:
其他好文 时间:
2018-06-08 10:36:08
阅读次数:
201
一、先说说编解码问题 编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。 Eg: 1 2 str1.decode('gb2312') #将gb2312编码的字符串转换成unicode编码 ...
分类:
编程语言 时间:
2018-06-07 23:08:49
阅读次数:
379
抓取ip的python脚本:via1.py#!/usr/bin/pythonimportoshttp=os.popen(‘ifconfig|grep10‘,‘r‘).readlines()str1=‘‘.join(http)pid=str1.split()[1].strip(‘addr:‘)printpid:wqpythona1.py
分类:
编程语言 时间:
2018-06-05 16:20:32
阅读次数:
164
抓取apache2的进程pid:via1.py#!/usr/bin/pythonimportoshttp=os.popen(‘netstat-ntpl|grep-w80‘,‘r‘).readlines()str1=‘‘.join(http)pid=str1.split()[6].strip(‘/apache2‘)printpid:wq
分类:
Web程序 时间:
2018-06-05 15:36:50
阅读次数:
207
append函数是向string的后面追加字符或字符串。 1).向string的后面加C-string string s = “hello “; const char *c = “out here “; s.append(c); // 把c类型字符串s连接到当前字符串结尾 s = “hello ou ...
分类:
移动开发 时间:
2018-06-03 22:19:33
阅读次数:
223
字面值: var str1='this is a simple string'; var num1=1.45; var answer1=true; 基本类型: var str2=String('this is a simple string'); var num2=Number(1.45); var ...
分类:
Web程序 时间:
2018-06-01 19:04:28
阅读次数:
466
闭包的作用 一句话,闭包的作用:将方法存于变量。 至于闭包的原因或者目的,或者说,为什么将方法存于变量,稍后再说。 闭包的条件 为了尽量避免用一大段话描述一个概念,我们理性一点地把闭包的条件划分成3个: P.S. 闭包的例子 “Talk is cheap, show me your code.” 我 ...
分类:
其他好文 时间:
2018-06-01 10:47:41
阅读次数:
173
char *Mystrcat(char*str1, char* str2){ if (str1 == NULL || str2 == NULL) return NULL; char*temp = str1; //申请指向字符的指针 while (*str1 != '\0') { str1++; // ...
分类:
其他好文 时间:
2018-05-30 19:27:30
阅读次数:
157
ord()函数主要用来返回对应字符的ascii码,chr()主要用来表示ascii码对应的字符他的输入时数字,可以用十进制,也可以用十六进制。 例如:print ord('a) #97 print chr(97) #a print chr(0x61) #a 一个简单的程序来灵活运用。 str1='a ...
分类:
编程语言 时间:
2018-05-29 10:23:45
阅读次数:
411
double temp=3.1415926; (F)Fixed point:string str1=temp.toString("f1");//保留一位小数 四舍五入 结果:3.1 (F)Fixed point:string str2=temp.toString("f2");//保留两位小数,四舍五 ...