笔记
Mzk殿
这个作者很懒,什么都没留下…
展开
-
MAC环境变量文件没有编辑权限
1 复制想要编辑的文本2 在终端用rm ~/.bash_profile 删除文件3 输入Y同意4 输入touch ~/.bash_profile 生成文件5 open ~/.bash_profile 粘贴之前的文本然后进行编辑6 source ~/.bash_profile原创 2021-11-28 09:12:52 · 704 阅读 · 0 评论 -
python线程
from multiprocessing import Process'''def test(i): print("我是子程序"+str(i))def main(): print("主程序开始") p=Process(target=test,args=(1,)) #args是参数元组,kwargs是子典参数 p.start() print("主程序结束")if __name__=="__main__": main()import原创 2021-11-15 10:39:29 · 82 阅读 · 0 评论 -
python进程
from multiprocessing import Process'''def test(i): print("我是子程序"+str(i))def main(): print("主程序开始") p=Process(target=test,args=(1,)) #args是参数元组,kwargs是子典参数 p.start() print("主程序结束")if __name__=="__main__": main()import原创 2021-11-14 16:53:31 · 678 阅读 · 0 评论 -
python对象类
'''class Geese: def __init__(self): print("fuck")wildgooes=Geese()class Goose: neck="long" leg="xi" wing="wu" def __init__(self,wing,mouth): #带参构造方法 print("fuck") print(wing+"big") print(mouth+"red"原创 2021-11-07 15:56:09 · 570 阅读 · 0 评论 -
python函数,lambda
'''def filterchar(string): "功能:过滤危险字" import re pattern=r'(黑客)|(抓包)|(监听)' sub=re.sub(pattern,"fuck",string) #替换 print(sub)about="我是黑客,喜欢监听和抓包."filterchar(about)def function_tips(): "每天输出一条励志文字" import datetime mot=[原创 2021-11-07 14:17:58 · 547 阅读 · 0 评论 -
python format用法
一、填充字符串位置print(“hello {0}, this is {1}.”.format(“world”, “python”)) # 根据位置下标进行填充print(“hello {}, this is {}.”.format(“world”, “python”)) # 根据顺序自动填充print(“hello {0}, this is {1}. {1} is a new language.”.format(“world”, “python”)) # 同一参数可以填充多次输出:h转载 2021-11-07 13:37:50 · 132 阅读 · 0 评论 -
javamap里compareTo和compare的实现方式
import java.util.*;class Student { private String name; private int age; public int getAge(){ return age; } public String getName(){ return name; } public void setName(String name){ this.name=name; }原创 2021-11-07 10:31:07 · 522 阅读 · 0 评论 -
java Treeset里compare的两种实现方式
import java.util.*;/*class Students implements Comparable<Students>{ private String id; private String name; Students(String id,String name){ this.id=id; this.name=name; } public String toString(){ return原创 2021-11-06 17:55:02 · 282 阅读 · 0 评论 -
python正则表达式
import re'''p=r'mr_\w+'string ='MR_SHOP'string1="我mr_shop"print(re.match(p,string,re.I))print(re.match(p,string1,re.I)) #不分大小写匹配string2='MR_SHOP mr_shop'm=re.match(p,string2,re.I)print(m.start())print(m.end())print(m.span())print(m.string)pr原创 2021-11-03 21:05:16 · 122 阅读 · 0 评论 -
python字符串
a="我自横刀向天笑"b=a.encode('GBK')print(b)c=b.decode('GBK')print(c)d="今朝有酒今朝醉"e=a+','+d #拼接字符串print(e)print(len(a)) #字符串长度print(len(a.encode())) #字符串占的字节数,一般一个汉字3个字节(或者4个)print(a[1]) #截断print(a[2:])print(a[:4])print(a[2:5:2])f=a.sp原创 2021-11-03 14:53:38 · 58 阅读 · 0 评论 -
python集合
a={"wo","ni","ta"}print(a)b=set(range(10,22,3)) #set()函数构建print(b)a.add(233) #添加函数print(a)'''a.remove("wo") #各种删除print(a)a.pop()print(a)a.clear()print(a)'''c={"wo","ta",444,666,233}print(a&c) #交集p原创 2021-11-02 09:11:35 · 49 阅读 · 0 评论 -
python字典
dictionary={"qq":"1050361","手机":"182865","邮箱":"cloud.com"}print(dictionary)a=[2,3,4]b=["ni","wo","ta"]c=dict(zip(a,b)) #用zip把两个列表创建为字典print(c)d=dict(wo ="niba",ta ="nima")print(d) #用键值对创建字典e=dict.fromkeys(b)原创 2021-11-02 08:51:35 · 62 阅读 · 0 评论 -
py列表学习
'''money=5.12+1312.123;money=int(money)print(money)money=input("请输入金额")print(money)a=48print(a<<2)a=int(input("输入一个数:"))if a>10: print("fuck you")a=int(input())b=a if a>0 else -aprint(b)string ='fuck you'print(string)for ch原创 2021-10-31 17:20:45 · 56 阅读 · 0 评论 -
模板 析构函数 重载
模板#include<iostream>using namespace std;template <class T>struct ab{ T a;};template <class T>class cd{ ab<T> b;public: void in(T a) { b.a = a; } T out() { return b.a; }};int main(){ cd<int> wode; wod原创 2021-06-01 22:16:07 · 351 阅读 · 1 评论 -
c++txt中文为乱码
找到txt,另存为时改成ANSI编码原创 2021-05-18 21:27:37 · 93 阅读 · 0 评论 -
判断的缩写
b=a>0?a:-atrue 为值一flase 为值二原创 2021-05-17 18:21:43 · 200 阅读 · 0 评论 -
java数据转换
#java数据转换##隐式int x=50;float y=x;输出y=50.0##显式int a=(int)45.23a=45int b=(int)’d’b=100原创 2021-05-17 18:16:29 · 67 阅读 · 0 评论 -
malloc string输出
(char*)malloc(sizeof(char)) 头文件malloc.hList* A:A=new List;string 输出printf (“%s”,str.c_str());原创 2021-05-16 17:43:21 · 116 阅读 · 0 评论