02 2021 档案

摘要:1、 >>> a = dict(a = 111, b = 222, c = 333, d = 444) >>> for i in reversed(a): ## 逆向输出 print(i,a[i]) d 444 c 333 b 222 a 111 2、 >>> a {'a': 111, 'b': 2 阅读全文
posted @ 2021-02-26 09:59 小鲨鱼2018 阅读(677) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = dict(zip(("a","b","c","d"),(111,222,333,444))) >>> a {'a': 111, 'b': 222, 'c': 333, 'd': 444} >>> b = a ## 假复制 >>> b {'a': 111, 'b': 222, ' 阅读全文
posted @ 2021-02-26 09:42 小鲨鱼2018 阅读(291) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = {"a":111,"b":222,"c":333,"d":444} >>> a {'a': 111, 'b': 222, 'c': 333, 'd': 444} >>> del a["a"] >>> a {'b': 222, 'c': 333, 'd': 444} >>> d 阅读全文
posted @ 2021-02-26 09:26 小鲨鱼2018 阅读(2853) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = dict(zip(("a","b","c","d"),(111,222,333,444))) >>> a {'a': 111, 'b': 222, 'c': 333, 'd': 444} >>> type(a) <class 'dict'> >>> a.clear() >>> 阅读全文
posted @ 2021-02-26 09:17 小鲨鱼2018 阅读(528) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = {"a":111,"b":222,"c":333,"d":444,"a":555} ## 如果键重复,则仅保留最后一个键值对 >>> a {'a': 555, 'b': 222, 'c': 333, 'd': 444} 阅读全文
posted @ 2021-02-25 21:50 小鲨鱼2018 阅读(1605) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = dict(a = 111, b = 222, c = 333, d = 444) >>> a["a"] 111 >>> a["c"] 333 >>> b = ("b","d") >>> for i in b: print(a[i]) 222 444 2、 >>> a = dic 阅读全文
posted @ 2021-02-25 21:39 小鲨鱼2018 阅读(160) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = dict(a = 111, b = 222, c = 333, d = 444) >>> a {'a': 111, 'b': 222, 'c': 333, 'd': 444} >>> a["e"] = 555 ## 增加项 >>> a {'a': 111, 'b': 222, 阅读全文
posted @ 2021-02-25 21:35 小鲨鱼2018 阅读(2743) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = {"a":111,"b":222,"c":333,"d":444} >>> a {'a': 111, 'b': 222, 'c': 333, 'd': 444} >>> len(a) 4 >>> type(a) <class 'dict'> 2、 >>> a = dict((( 阅读全文
posted @ 2021-02-25 21:25 小鲨鱼2018 阅读(159) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["ccc","aaa","ddd","bbb"] ## 利用列表分片 >>> b = a[::-1] >>> b ['bbb', 'ddd', 'aaa', 'ccc'] 2、 >>> a = ["ccc","aaa","ddd","bbb"] >>> b = 阅读全文
posted @ 2021-02-25 21:03 小鲨鱼2018 阅读(1369) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aaa","bbb","ccc"] ## 列表,中括号,逗号 >>> type(a) <class 'list'> >>> b = ("aaa","bbb","ccc") ## 元组,小括号,逗号 >>> type(b) <class 'tuple'> >>> c = "a 阅读全文
posted @ 2021-02-25 20:35 小鲨鱼2018 阅读(155) 评论(0) 推荐(0) 编辑
摘要:zip函数返回有可迭代对象共同组成的元组。 1、 >>> a = "abcde" >>> b = [100,200,300,400,500] >>> c = ("aaa","bbb","ccc","ddd","eee") >>> for i in zip(a,b,c): ## 返回由可迭代对象共同组 阅读全文
posted @ 2021-02-25 16:41 小鲨鱼2018 阅读(93) 评论(0) 推荐(0) 编辑
摘要:enumerate返回一个二元组的可迭代对象,二元组就是元素数为二的元组。 1、字符串 >>> a = "erqwu" >>> enumerate(a) <enumerate object at 0x0000018555A1D880> >>> for i in enumerate(a): ## 可迭 阅读全文
posted @ 2021-02-25 16:33 小鲨鱼2018 阅读(633) 评论(0) 推荐(0) 编辑
摘要:1、字符串反转 >>> a = "839574" >>> reversed(a) <reversed object at 0x00000215CACA0D60> >>> for i in reversed(a): ## reversed反转为迭代器对象 print(i,end = ";") 4;7; 阅读全文
posted @ 2021-02-25 16:22 小鲨鱼2018 阅读(220) 评论(0) 推荐(0) 编辑
摘要:1、字符串排序 >>> a = "349217" >>> b = sorted(a) >>> b ['1', '2', '3', '4', '7', '9'] >>> type(b) ## 返回类型为列表 <class 'list'> >>> c = sorted(a,reverse = True) 阅读全文
posted @ 2021-02-25 16:07 小鲨鱼2018 阅读(138) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = 123 >>> a 123 >>> type(a) <class 'int'> >>> b = float(a) ## 整数转化为浮点 >>> b 123.0 >>> type(b) <class 'float'> >>> c = str(a) ## 整数转化为字符串 >>> 阅读全文
posted @ 2021-02-25 15:13 小鲨鱼2018 阅读(192) 评论(0) 推荐(0) 编辑
摘要:tuple函数将可迭代对象转化为元组。 1、 >>> tuple("abcde") ('a', 'b', 'c', 'd', 'e') >>> a = tuple("abcde") ## 字符串作为可迭代对象,将字符串转化为元组 >>> a ('a', 'b', 'c', 'd', 'e') >>> 阅读全文
posted @ 2021-02-25 15:01 小鲨鱼2018 阅读(509) 评论(0) 推荐(0) 编辑
摘要:list函数将可迭代对象转化为列表 1、 >>> list("abcde") ## 字符串作为可迭代对象,将字符串转化为列表 ['a', 'b', 'c', 'd', 'e'] >>> a = list("abcde") >>> a ['a', 'b', 'c', 'd', 'e'] >>> typ 阅读全文
posted @ 2021-02-25 14:51 小鲨鱼2018 阅读(703) 评论(0) 推荐(0) 编辑
摘要:1、格式化浮点数 >>> "%f" % 100 '100.000000' >>> "%.2f" % 100 '100.00' >>> "%f" % 100.35667324 '100.356673' >>> "%.1f" % 100.35667324 '100.4' 2、科学计数法 >>> "%e" 阅读全文
posted @ 2021-02-25 14:25 小鲨鱼2018 阅读(3903) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "abcd" >>> b = "xyzp" >>> a + b ## +号拼接 'abcdxyzp' >>> c = (a,b) >>> c ('abcd', 'xyzp') >>> "".join(c) ## 内置方法join拼接 'abcdxyzp' >>> "%s%s" 阅读全文
posted @ 2021-02-25 14:16 小鲨鱼2018 阅读(63) 评论(0) 推荐(0) 编辑
摘要:1、 format位置参数 >>> "{0},{1},{2}".format("aaa","bbb","ccc") 'aaa,bbb,ccc' >>> "{2},{1},{0}".format("aaa","bbb","ccc") 'ccc,bbb,aaa' >>> "{0},{2},{1}".fo 阅读全文
posted @ 2021-02-25 13:55 小鲨鱼2018 阅读(144) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "abcabcabcabc" >>> len(a) 12 >>> a.partition("b") ## 设定b为分割符,返回三元组 ('a', 'b', 'cabcabcabc') >>> a.partition("x") ## 字符串中不含有指定分隔符 ('abcabcab 阅读全文
posted @ 2021-02-25 12:36 小鲨鱼2018 阅读(354) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = " good " ## 测试字符串,左右都有空格 >>> a ' good ' >>> len(a) 10 >>> a.lstrip() ## 删除左侧空格 'good ' >>> a.rstrip() ## 删除右侧空格 ' good' >>> a.strip() ## 删除 阅读全文
posted @ 2021-02-25 12:29 小鲨鱼2018 阅读(2170) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "good" >>> a.ljust(1) 'good' >>> a.ljust(10) ## 左对齐 'good ' >>> a.ljust(10,"-") ## 左对齐,以-填充多余宽度 'good ' >>> a.ljust(20,"x") 'goodxxxxxxxxxx 阅读全文
posted @ 2021-02-25 12:22 小鲨鱼2018 阅读(1281) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "gooood" >>> a.replace("o","x") ## 将o全部替换为x 'gxxxxd' >>> a.replace("o","x",1) ## 指定替换次数 'gxoood' >>> a.replace("o","x",2) 'gxxood' >>> a.re 阅读全文
posted @ 2021-02-25 12:16 小鲨鱼2018 阅读(3128) 评论(0) 推荐(0) 编辑
摘要:1、拆分字符串 >>> a = "2018:03:15" >>> a '2018:03:15' >>> a.split(sep = ":") ## sep指定拆分的分隔符 ['2018', '03', '15'] >>> a = "ab:c:aaa:d:ee:fddf:dfd:34:2:89:887 阅读全文
posted @ 2021-02-25 10:32 小鲨鱼2018 阅读(485) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "good" >>> a 'good' >>> a.find("g") ## 如果查找字符存在,则返回第一个索引 0 >>> a.find("o") 1 >>> a.find("d") 3 >>> a.find("x") ## 如果不存在,则返回-1 -1 >>> a.find 阅读全文
posted @ 2021-02-25 10:01 小鲨鱼2018 阅读(1056) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "g\to\to\tg" >>> a 'g\to\to\tg' >>> a.expandtabs() 'g o o g' >>> 阅读全文
posted @ 2021-02-25 09:52 小鲨鱼2018 阅读(678) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "good" >>> a 'good' >>> a.startswith("g") ## 判断字符串是否以g开头 True >>> a.startswith("o") ## 判断是否以o开头 False >>> a.startswith("d") False >>> a.end 阅读全文
posted @ 2021-02-25 09:48 小鲨鱼2018 阅读(1489) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "good" >>> a 'good' >>> a.count("g") ## 统计"g"出现的次数 1 >>> a.count("o") ## 统计"o"出现的次数 2 >>> a.count("d") ## 统计d出现的次数 1 >>> a.count("go") ## 统 阅读全文
posted @ 2021-02-25 09:36 小鲨鱼2018 阅读(13106) 评论(0) 推荐(0) 编辑
摘要:>>> a = "good" ##测试字符串 >>> a 'good' >>> type(a) <class 'str'> >>> a.center(1) ## 指定宽度1 'good' >>> a.center(10) ## 指定宽度10,默认使用空格填充 ' good ' >>> a.cente 阅读全文
posted @ 2021-02-25 09:16 小鲨鱼2018 阅读(1469) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = "gooD" ##测试字符串 >>> a.lower() ##全部变为小写 'good' >>> a.upper() ## 全部变为大写 'GOOD' >>> a.casefold() ## 全部变为小写 'good' >>> a.capitalize() ## 首字母大写 ' 阅读全文
posted @ 2021-02-25 09:07 小鲨鱼2018 阅读(444) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ("aaa","bbb","ccc","ddd","eee","fff") >>> a[:2] + a[3:] ## 删除元素ccc ('aaa', 'bbb', 'ddd', 'eee', 'fff') >>> a[:2] + a[4:] ## 删除元素ccc和ddd ('a 阅读全文
posted @ 2021-02-25 08:42 小鲨鱼2018 阅读(1778) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ("aaa","bbb","ccc","ddd","eee") >>> type(a) <class 'tuple'> >>> a[:2] + ("xxx",) + a[2:] ('aaa', 'bbb', 'xxx', 'ccc', 'ddd', 'eee') >> 阅读全文
posted @ 2021-02-25 08:27 小鲨鱼2018 阅读(18247) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ("aaa","bbb","ccc","ddd","eee","fff") >>> type(a) <class 'tuple'> >>> id(a) 1360669254176 >>> a[2] = "xxx" Traceback (most recent call last 阅读全文
posted @ 2021-02-24 22:54 小鲨鱼2018 阅读(2304) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aaa","bbb","ccc","ddd"] >>> a[1] = "xxx" ## 修改第二个元素 >>> a ['aaa', 'xxx', 'ccc', 'ddd'] >>> a[2:4] = ["mmm","nnn"] ## 修改第三和第四个元素 >>> a ['aaa 阅读全文
posted @ 2021-02-24 22:13 小鲨鱼2018 阅读(4472) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = 100 >>> b = 200 >>> print(a,b) 100 200 >>> print("the score is:",a) the score is: 100 >>> print(f"the score is:{a}") the score is:100 阅读全文
posted @ 2021-02-24 22:04 小鲨鱼2018 阅读(339) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aaa","bbb","aaa","aaa","bbb","aaa","ccc","ddd","ddd"] >>> b = [] >>> for i in a: if i not in b: b.append(i) >>> b ## for循环去重复 ['aaa', 'bb 阅读全文
posted @ 2021-02-24 21:59 小鲨鱼2018 阅读(239) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aaa","bbb","ccc","ddd"] >>> b = ["ccc","ddd","eee","fff"] >>> c = [] >>> for i in a: if i not in b: c.append(i) >>> c ['aaa', 'bbb'] >>> 阅读全文
posted @ 2021-02-24 21:45 小鲨鱼2018 阅读(89) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aaa","bbb","ccc","ddd"] >>> b = ["ccc","ddd","eee","fff"] >>> c = a + b >>> c ['aaa', 'bbb', 'ccc', 'ddd', 'ccc', 'ddd', &# 阅读全文
posted @ 2021-02-24 21:38 小鲨鱼2018 阅读(1183) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aa","bb","aa","cc","aa","dd","bb","aa","cc"] >>> a ['aa', 'bb', 'aa', 'cc', 'aa', 'dd', 'bb', 'aa', 'cc'] > 阅读全文
posted @ 2021-02-24 10:51 小鲨鱼2018 阅读(2463) 评论(0) 推荐(0) 编辑
摘要:>>> sum = 0 >>> for i in range(1,101): ## 利用for循环 sum += i >>> print(sum) 5050 >>> del sum >>> sum(list(range(1,101))) ## 利用sum函数 5050 >>> sum = 0 >>> 阅读全文
posted @ 2021-02-24 10:44 小鲨鱼2018 阅读(3366) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = [20,10,50,40,30] >>> max = a[0] >>> for i in a: if i > max: max = i >>> print(max) 50 >>> min = a[0] >>> for i in a: if i < min: min = i >> 阅读全文
posted @ 2021-02-24 10:37 小鲨鱼2018 阅读(725) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["cc","aa","bb","cc","aa","dd","aa","cc","ee","dd"] >>> sorted(set(a)) ['aa', 'bb', 'cc', 'dd', 'ee'] >>> b = sorted(set(a 阅读全文
posted @ 2021-02-24 10:19 小鲨鱼2018 阅读(347) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = [34,28,187,22,128] >>> max = a[0] >>> for i in a: ## 求最大值 if i > max: max = i >>> print(max) 187 >>> min = a[0] >>> for i in a: ## 求最小值 if 阅读全文
posted @ 2021-02-24 10:11 小鲨鱼2018 阅读(5210) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aa","aa","bb","cc","bb","aa","dd","cc","aa","aa","aa"] >>> a ['aa', 'aa', 'bb', 'cc', 'bb', 'aa', 'dd', &# 阅读全文
posted @ 2021-02-24 09:58 小鲨鱼2018 阅读(186) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = [] >>> b = ["aa","bb","cc"] >>> if len(a) == 0: print("empty!") empty! >>> if len(b) == 0: print("empty!") 2、 >>> a = ["aa","bb","cc","dd"] 阅读全文
posted @ 2021-02-24 09:37 小鲨鱼2018 阅读(4598) 评论(0) 推荐(0) 编辑
摘要:>>> import random >>> random.randint(1,10) ## 随机抽取1-10的数字 1 >>> random.randint(1,10) 4 >>> random.randint(1,10) 9 >>> random.randint(1,100) 67 >>> ran 阅读全文
posted @ 2021-02-24 09:26 小鲨鱼2018 阅读(61) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aa","bb","cc","aa","dd","ee","aa","aa","ff","aa"] >>> a ['aa', 'bb', 'cc', 'aa', 'dd', 'ee', 'aa', 'aa',  阅读全文
posted @ 2021-02-24 09:22 小鲨鱼2018 阅读(894) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aa","bb","cc","dd","ee"] >>> a ['aa', 'bb', 'cc', 'dd', 'ee'] >>> "aa" in a True >>> "dd" in a True >>> "aa" not in a False & 阅读全文
posted @ 2021-02-24 09:15 小鲨鱼2018 阅读(227) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aa","bb","cc","dd","ee"] >>> temp = a[1] ## 引入变量 >>> temp 'bb' >>> a[1] = a[3] >>> a ['aa', 'dd', 'cc', 'dd', 'ee'] >>> a[3] = temp > 阅读全文
posted @ 2021-02-24 09:13 小鲨鱼2018 阅读(4080) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["ee","cc","aa","ff","aa","cc","dd","ee","dd","ee","aa","aa","bb"] ##生成列表 >>> a ['ee', 'cc', 'aa', 'ff', 'aa 阅读全文
posted @ 2021-02-24 08:31 小鲨鱼2018 阅读(386) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aa","cc","aa","bb","bb","aa","dd","ee"] >>> a ['aa', 'cc', 'aa', 'bb', 'bb', 'aa', 'dd', 'ee'] >>> "aa" in 阅读全文
posted @ 2021-02-24 08:22 小鲨鱼2018 阅读(123) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["dd","cc","aa","bb"] >>> a ['dd', 'cc', 'aa', 'bb'] >>> b = sorted(a) ## 排序并赋值给b >>> b ['aa', 'bb', 'cc', 'dd'] >>> a ['dd', 'cc&# 阅读全文
posted @ 2021-02-24 08:18 小鲨鱼2018 阅读(235) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aa","bb","cc","dd","ee","ff","gg","hh"] >>> a ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh'] >>> a.pop() ## pop删除  阅读全文
posted @ 2021-02-24 08:10 小鲨鱼2018 阅读(75) 评论(0) 推荐(0) 编辑
摘要:>>> a = ["aa","bb","cc"] ## 创建列表 >>> a ['aa', 'bb', 'cc'] >>> a.append("dd") ## append添加 >>> a ['aa', 'bb', 'cc', 'dd'] >>> a.extend(["ee"]) >> 阅读全文
posted @ 2021-02-24 08:06 小鲨鱼2018 阅读(579) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = list(range(1,11)) ## 生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> a[::-1] ## 倒序排列 [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>> a [1, 2, 3, 4, 5, 6 阅读全文
posted @ 2021-02-23 22:33 小鲨鱼2018 阅读(5239) 评论(0) 推荐(0) 编辑
摘要:1、>>> a = ["aa","bb","cc","dd"] ## 生成列表 >>> a ['aa', 'bb', 'cc', 'dd'] >>> a = [] ## 清空列表 >>> a []2、 >>> a = ["aa","bb","cc","dd"] ## 生成列表 > 阅读全文
posted @ 2021-02-23 22:25 小鲨鱼2018 阅读(457) 评论(0) 推荐(0) 编辑
摘要:>>> a = list(range(1,21)) ## 生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >>> a[::2] ## 提取第奇数元素 [1, 3, 5, 7, 9, 阅读全文
posted @ 2021-02-23 22:22 小鲨鱼2018 阅读(7941) 评论(0) 推荐(0) 编辑
摘要:>>> a = list(range(1,21)) ##生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >>> a[:10] ## 提取前10个元素 [1, 2, 3, 4, 5, 阅读全文
posted @ 2021-02-23 22:19 小鲨鱼2018 阅读(17642) 评论(0) 推荐(0) 编辑
摘要:1、 >>> a = ["aaa","bbb","ccc","ddd"] >>> b = reversed(a) >>> c = [] >>> for i in b: c.append(i) >>> c ['ddd', 'ccc', 'bbb', 'aaa'] 2、 >>> a = ["aaa"," 阅读全文
posted @ 2021-02-22 17:54 小鲨鱼2018 阅读(473) 评论(0) 推荐(0) 编辑
摘要:1、 aaa = "123" answer = input("please input the answer:") while True: if answer == aaa: break answer = input("please input the answer,again:") print(" 阅读全文
posted @ 2021-02-16 19:38 小鲨鱼2018 阅读(130) 评论(0) 推荐(0) 编辑
摘要:1、for 循环 >>> sum = 0 >>> for i in range(101): sum += i >>> print(sum) 5050 2、while循环 >>> sum = 0 >>> i = 0 >>> while i <= 100: sum += i i += 1 >>> pri 阅读全文
posted @ 2021-02-15 22:07 小鲨鱼2018 阅读(5269) 评论(0) 推荐(0) 编辑
摘要:1、 # prize test age = 20 score = "A" if age < 18: if score == "A": print("congratulations!!!") else: print("score not A!!!") else: print("age excess 1 阅读全文
posted @ 2021-02-06 23:06 小鲨鱼2018 阅读(98) 评论(0) 推荐(0) 编辑
摘要:1、assert可以植入程序中进行程序检查 >>> a = 5 >>> b = 3 >>> assert a > 0 >>> assert a < 0 Traceback (most recent call last): File "<pyshell#279>", line 1, in <modul 阅读全文
posted @ 2021-02-06 23:02 小鲨鱼2018 阅读(356) 评论(0) 推荐(0) 编辑
摘要:1、 #guess integer game import random secret = random.randint(1,10) temp = input("please input an integer:") guess = int(temp) times = 1 while (guess ! 阅读全文
posted @ 2021-02-06 20:38 小鲨鱼2018 阅读(265) 评论(0) 推荐(0) 编辑
摘要:1、 >>> import random >>> random.randint(1,5) 1 >>> random.randint(1,5) 4 >>> random.randint(1,5) 3 >>> random.randint(1,5) 2 >>> random.randint(10,20) 阅读全文
posted @ 2021-02-06 20:03 小鲨鱼2018 阅读(393) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> int main(void) { int a[2][4][3] ={{{20,10,12},{30,20,10},{20,10,50},{20,10,30}},{{30,10,20},{40,30,10},{10,20,30},{50,10,20}}}; 阅读全文
posted @ 2021-02-06 17:20 小鲨鱼2018 阅读(474) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> int main(void) { int i, j; int a[6][2]; puts("please input the elements of the 6 * 2 matrix."); for (i = 0; i < 6; i++) { for (j 阅读全文
posted @ 2021-02-06 14:14 小鲨鱼2018 阅读(2484) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> int main(void) { int a[4][3] = {{2,5,4},{1,2,4},{5,3,2},{4,2,6}}; int b[3][4] = {{2,1,6,2},{3,2,4,1},{5,2,1,2}}; int i, j, k; in 阅读全文
posted @ 2021-02-05 23:49 小鲨鱼2018 阅读(2244) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> int main(void) { int a[4][3] = {{50,60,40},{80,70,60},{60,70,70},{90,80,70}}; int b[4][3] = {{40,60,80},{20,70,90},{60,80,90},{5 阅读全文
posted @ 2021-02-05 14:10 小鲨鱼2018 阅读(475) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> # define NUMBER 80 int main(void) { int a[NUMBER]; int number; puts("please input the number of the student."); do { printf("num 阅读全文
posted @ 2021-02-04 18:48 小鲨鱼2018 阅读(454) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> #define NUMBER 5 int main(void) { int a[NUMBER]; int i; puts("please input several numbers."); for (i = 0; i < NUMBER; i++) { pr 阅读全文
posted @ 2021-02-04 00:04 小鲨鱼2018 阅读(149) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> #define NUMBER 5 int main(void) { int i; int a[NUMBER]; puts("please input the score of the students."); for (i = 0; i < NUMBER; 阅读全文
posted @ 2021-02-03 23:11 小鲨鱼2018 阅读(3653) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> #define XXX 3 int main(void) { int i; int a[XXX]; int sum = 0; puts("please input the scores of the students."); for (i = 0; i < 阅读全文
posted @ 2021-02-03 22:31 小鲨鱼2018 阅读(355) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> int main(void) { int a[8]; int i; for (i = 0; i < 8; i++) { printf("a[%d] = ",i); scanf("%d", &a[i]); } puts(" \n \n "); int tem 阅读全文
posted @ 2021-02-03 21:17 小鲨鱼2018 阅读(1971) 评论(0) 推荐(0) 编辑
摘要:1、查看系统 [root@centos7 home]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@centos7 home]# hostnamectl Static hostname: centos7 Ico 阅读全文
posted @ 2021-02-03 00:51 小鲨鱼2018 阅读(161) 评论(0) 推荐(0) 编辑
摘要:1、查看系统 [root@centos8 home]# cat /etc/redhat-release CentOS Linux release 8.3.2011 [root@centos8 home]# hostnamectl Static hostname: centos8 Icon name: 阅读全文
posted @ 2021-02-02 23:44 小鲨鱼2018 阅读(818) 评论(0) 推荐(0) 编辑
摘要:1、R-4.0.3安装过程中隐患 2、查看当前系统 [root@centos8 test]# cat /etc/redhat-release CentOS Linux release 8.3.2011 [root@centos8 test]# hostnamectl Static hostname: 阅读全文
posted @ 2021-02-02 17:38 小鲨鱼2018 阅读(2788) 评论(0) 推荐(0) 编辑
摘要:1、当前路径文件 > dir() [1] "a.txt" 2、加载包,绘图测试 > library(Cairo) > Cairo.capabilities() png jpeg tiff pdf svg ps x11 win raster TRUE FALSE FALSE TRUE TRUE TRU 阅读全文
posted @ 2021-02-02 13:19 小鲨鱼2018 阅读(709) 评论(0) 推荐(0) 编辑
摘要:1、问题 install.packages('Cairo', repos='https://mirror.lzu.edu.cn/CRAN/') ………… ………… configure: error: Cannot find cairo.h! Please install cairo (http:// 阅读全文
posted @ 2021-02-02 13:05 小鲨鱼2018 阅读(3292) 评论(0) 推荐(0) 编辑
摘要:1、查看R版本 [root@centos8 test]# R --version R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out" Copyright (C) 2020 The R Foundation for Statistical 阅读全文
posted @ 2021-02-02 00:23 小鲨鱼2018 阅读(1130) 评论(0) 推荐(0) 编辑
摘要:1、查看当前系统 [root@rhel8 home]# cat /etc/redhat-release Red Hat Enterprise Linux release 8.3 (Ootpa) [root@rhel8 home]# hostnamectl Static hostname: rhel8 阅读全文
posted @ 2021-02-01 17:44 小鲨鱼2018 阅读(2223) 评论(0) 推荐(0) 编辑
摘要:1、查看当前系统: [root@rhel8 home]# cat /etc/redhat-release Red Hat Enterprise Linux release 8.3 (Ootpa) [root@rhel8 home]# hostnamectl Static hostname: rhel 阅读全文
posted @ 2021-02-01 04:47 小鲨鱼2018 阅读(1020) 评论(0) 推荐(0) 编辑
摘要:查看系统: [root@centos8 home]# cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core) 1、下载R安装包 [root@centos8 home]# wget https://mirror.bjtu.edu.cn/ 阅读全文
posted @ 2021-02-01 04:28 小鲨鱼2018 阅读(607) 评论(0) 推荐(0) 编辑
摘要:查看系统: [root@rhel7 home]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.9 (Maipo) [root@rhel7 home]# hostnamectl Static hostname: r 阅读全文
posted @ 2021-02-01 02:01 小鲨鱼2018 阅读(1166) 评论(0) 推荐(0) 编辑
摘要:查看系统: [root@centos7 ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@centos7 ~]# hostnamectl Static hostname: centos7 Icon name: 阅读全文
posted @ 2021-02-01 00:30 小鲨鱼2018 阅读(1179) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示