上一页 1 2 3 4 5 6 7 8 9 ··· 36 下一页
摘要: #include <stdio.h> #include <unistd.h> int main(){ printf("the pid is %d\n",getpid()); return 0; } gcc -o gotTest main.c readelf -a gotTest 可以得到如下结果: 阅读全文
posted @ 2022-08-10 11:31 repinkply 阅读(114) 评论(0) 推荐(0)
摘要: cut grep "/bin/bash" /etc/passwd root:x:0:0:root:/root:/bin/bash wj:x:1000:1000:wj,,,:/home/wj:/bin/bash grep "/bin/bash" /etc/passwd | grep -v "root" 阅读全文
posted @ 2022-08-04 20:29 repinkply 阅读(73) 评论(0) 推荐(0)
摘要: 1.shell中变量类型默认是字符串,这点和和C/C++/JAVA/Python不同。 echo $a 输出为空。 有2种结果: 1.没有定义变量a 2.定义了变量a,但是变量a没有任何值。 set 关键字为输出linux所有的变量,包括预定义的和自定义的。 一旦设置 set -u,如果没有定义变量 阅读全文
posted @ 2022-08-04 10:37 repinkply 阅读(31) 评论(0) 推荐(0)
摘要: 一、枚举存在的意义 枚举存在的意义是它的标签,而不是他背后的数值。每个类中枚举值是独立无二的,枚举值是不能重复的每个枚举类必须继承自EnumPython中,枚举实际上是一个类 from enum import Enum class VIP(Enum): YELLOW = 1 GREEN = 2 BL 阅读全文
posted @ 2022-06-04 21:11 repinkply 阅读(56) 评论(0) 推荐(0)
摘要: 一、边界匹配 import re string = '123456789' result = re.findall('\d{4,8}',string) print(result) # 输出['12345678'] 在匹配项最前面加上^,最后面加上$,则为边界匹配。此时会匹配完整的字符串,不会像上面那 阅读全文
posted @ 2022-06-03 22:29 repinkply 阅读(49) 评论(0) 推荐(0)
摘要: 一、类与对象的变量查找顺序 class Student(): name = 'Delphi' age = 30 def __init__(self,name='',age=''): name=name age=age def do_homework(self): print(self.name+", 阅读全文
posted @ 2022-06-02 22:21 repinkply 阅读(27) 评论(0) 推荐(0)
摘要: 1.推荐python 写法 def damage(skill1,skill2): damage1 = skill1*3 damage2 = skill2*2 +10 return damage1,damage2 damages=damage(3,6) print(type(damages)) pri 阅读全文
posted @ 2022-06-01 22:28 repinkply 阅读(30) 评论(0) 推荐(0)
摘要: 1.while 循环 counter =1 while counter <= 10: counter += 1 print(counter) else: print("EOF") 2.for 循环 a=[['apple','orange','banana','grape'],(1,2,3)] for 阅读全文
posted @ 2022-05-29 18:06 repinkply 阅读(42) 评论(0) 推荐(0)
摘要: 1. a="hello" print(type(a) == str) # 推荐这样来判断类型 print(isinstance(a,str)) # python中,推荐这样来判断类型 2.isinstance(...),另外一种用法。 isinstance(...) 第二个参数是一个元组,判断对象a 阅读全文
posted @ 2022-05-28 22:51 repinkply 阅读(23) 评论(0) 推荐(0)
摘要: 1.逻辑运算符 print(1 and 0) # 输出0 print(1 and 0) #输出0 print(1 and 2) #输出2 print(2 and 1) #输出1 print(3 and 5) #输出5 print(5 and 3) #输出3 print(0 or 1) #输出1 pr 阅读全文
posted @ 2022-05-28 22:35 repinkply 阅读(36) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 36 下一页