上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 82 下一页
摘要: struct Person man1 = {"jerry", "fastidious", {"June", 4, 1965}, 34}; //注意这里的对应顺序,可以用curly brace把Birthday括起来 阅读全文
posted @ 2020-06-04 17:55 profesor 阅读(969) 评论(0) 推荐(0)
摘要: #include <stdio.h> struct date { int day; char month[10]; int year; }; void out(struct date); // 1.该行一定要置于struct date定义的下面, 2.struct date是新定义的一种数据结构,类 阅读全文
posted @ 2020-06-04 17:20 profesor 阅读(301) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <string.h> struct date { int day; //int month; char month[10]; int year; }; //别丢掉这里的逗号 int main() { struct date today; tod 阅读全文
posted @ 2020-06-04 16:16 profesor 阅读(105) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <string.h> int main() { char str[] = "there are plenty of good reasons "; char str0[] = "for a young person to choose to g 阅读全文
posted @ 2020-06-02 19:17 profesor 阅读(188) 评论(0) 推荐(0)
摘要: 提醒:在python3中,reduce被移到了functools里面 from functools import reduce str1 = 'the quick brown fox' str2 = ' jumps over ' str3 = 'the lazy dog.' print(reduce 阅读全文
posted @ 2020-06-02 19:09 profesor 阅读(1257) 评论(0) 推荐(0)
摘要: my_set = set() #create a new set, 虽然set的显示结果为{item, item1...},但是不能用{}来创建集合,应该{}默认是创建dict print(help(my_set)) #查看帮助 my_set.add('jerry') #添加元素用add,而非lis 阅读全文
posted @ 2020-05-31 09:58 profesor 阅读(325) 评论(0) 推荐(0)
摘要: #!/bin/bash #用while loop计算1到100的和 num=1 sum=0 while [ $num -lt 101 ]; do sum=$(($sum+$num)) num=$(($num+1)) done printf "sum is %s\n" $sum #!/bin/bash 阅读全文
posted @ 2020-05-30 22:37 profesor 阅读(314) 评论(0) 推荐(0)
摘要: vim打开 vim ~/.vimrc 添加 syntax on #语法高亮set number #显示行数 set hlsearch set tabstop=4 set autoindent 阅读全文
posted @ 2020-05-30 20:48 profesor 阅读(167) 评论(0) 推荐(0)
摘要: 当需要输入密码时,为了保证密码不在屏幕上显示出来,可以考虑import getpass from getpass import getpass username = input('input your username: ') if username == 'jerry': password = g 阅读全文
posted @ 2020-05-30 15:41 profesor 阅读(344) 评论(0) 推荐(0)
摘要: Python: #计算并输出1~100之间的奇数之和与偶数之和 from functools import reduce print("evenSum=",end='') print(reduce(lambda a, b: a + b, filter(lambda i: i%2 == 0, [i f 阅读全文
posted @ 2020-05-29 14:13 profesor 阅读(4323) 评论(0) 推荐(0)
上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 82 下一页