摘要:
#include #define PI 3.14 using namespace std; class Circle { float radius; public: void getRadius(); float area(); void showRadius(); }; void Circle :: getRadius() { cout > ra...
阅读全文
posted @ 2018-11-23 21:19
anobscureretreat
阅读(2053)
推荐(0)
摘要:
#include #include using namespace std; class stringfun { char name[20]; public: void concatString(char a[],char b[]) { strcat(a," "); strcat(a,b); ...
阅读全文
posted @ 2018-11-23 21:13
anobscureretreat
阅读(1863)
推荐(0)
摘要:
import yaml yaml_dict={"sss":"111","ddd":"222"} with open("a.yaml", "w") as f: yaml.safe_dump(yaml_dict,f,encoding='utf-8', allow_unicode=True) with open("a.yaml") as f: yaml_dict = yaml.l...
阅读全文
posted @ 2018-11-23 19:00
anobscureretreat
阅读(388)
推荐(0)
摘要:
>>> 'spam eggs' # single quotes 'spam eggs' >>> 'doesn\'t' # use \' to escape the single quote... "doesn't" >>> "doesn't" # ...or use double quotes instead "doesn't" >>> '"Yes,"
阅读全文
posted @ 2018-11-23 17:07
anobscureretreat
阅读(219)
推荐(0)
摘要:
>>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] >>> letters ['a', 'b', 'c', 'd', 'e', 'f', 'g'] >>> # replace some values >>> letters[2:5] = ['C
阅读全文
posted @ 2018-11-23 16:54
anobscureretreat
阅读(6306)
推荐(0)
摘要:
>>> a = ['a', 'b', 'c'] >>> n = [1, 2, 3] >>> x = [a, n] >>> x [['a', 'b', 'c'], [1, 2, 3]] >>> x[0] ['a', 'b', 'c'] >>> x[0][1] 'b'
阅读全文
posted @ 2018-11-23 16:50
anobscureretreat
阅读(204)
推荐(0)
摘要:
第一个元素一定是最小的,如果每次只想拿到列表的最小值,不想整个列表排序,可以通过不断返回最小值的方法实现
阅读全文
posted @ 2018-11-23 16:29
anobscureretreat
阅读(150)
推荐(0)
摘要:
import zipfile import os,shutil import openpyxl file_list_pos="" fileName="" zipfileName="" def un_zip(file_name): """unzip zip file""" zip_file = zipfile.ZipFile(file_name) if o...
阅读全文
posted @ 2018-11-23 16:06
anobscureretreat
阅读(1048)
推荐(0)
摘要:
在当前路径解压zip压缩包,生成同名文件夹,内部目录结构与压缩包一致
阅读全文
posted @ 2018-11-23 16:04
anobscureretreat
阅读(5047)
推荐(0)
摘要:
import zipfile file_name="a.txt" f = zipfile.ZipFile('test.zip','w',zipfile.ZIP_STORED) f.write(file_name) f.close()
阅读全文
posted @ 2018-11-23 15:47
anobscureretreat
阅读(2809)
推荐(0)
posted @ 2018-11-23 14:51
anobscureretreat
阅读(800)
推荐(0)
摘要:
import glob x=glob.glob('*.py') print(x)
阅读全文
posted @ 2018-11-23 11:01
anobscureretreat
阅读(3735)
推荐(0)
摘要:
import itertools original_list = [[2,4,3],[1,5,6], [9], [7,9,0]] new_merged_list = list(itertools.chain(*original_list)) print(new_merged_list)
阅读全文
posted @ 2018-11-22 21:29
anobscureretreat
阅读(2716)
推荐(0)
posted @ 2018-11-22 20:32
anobscureretreat
阅读(216)
推荐(0)
摘要:
import re x=re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') print(x)
阅读全文
posted @ 2018-11-22 20:29
anobscureretreat
阅读(1410)
推荐(0)
摘要:
def scope_test(): def do_local(): spam = "local spam" def do_nonlocal(): nonlocal spam spam = "nonlocal spam" def do_global(): global spam spam...
阅读全文
posted @ 2018-11-22 20:27
anobscureretreat
阅读(208)
推荐(0)
posted @ 2018-11-22 19:49
anobscureretreat
阅读(458)
推荐(0)
摘要:
import os with os.scandir(r"C:\Users\macname\Desktop") as it: for entry in it: if entry.name.startswith('Auto') and entry.is_file(): print(entry.name)
阅读全文
posted @ 2018-11-22 19:43
anobscureretreat
阅读(385)
推荐(0)
摘要:
import os with os.scandir(r"C:\Users\macname\Desktop") as it: for entry in it: if not entry.name.startswith('Auto') and entry.is_file(): print(entry.name)
阅读全文
posted @ 2018-11-22 19:39
anobscureretreat
阅读(304)
推荐(0)
摘要:
打印所有以.txt为结尾的文件名称
阅读全文
posted @ 2018-11-22 17:41
anobscureretreat
阅读(413)
推荐(0)
posted @ 2018-11-22 17:27
anobscureretreat
阅读(199)
推荐(0)
摘要:
同:都是能遍历集合(表、数组) 异:ipairs 仅仅遍历值,按照索引升序遍历,索引中断停止遍历。即不能返回 nil,只能返回数字 0,如果遇到 nil 则退出。它只能遍历到集合中出现的第一个不是整数的 key。 pairs 能遍历集合的所有元素。即 pairs 可以遍历集合中所有的 key,并且除
阅读全文
posted @ 2018-11-22 12:38
anobscureretreat
阅读(328)
推荐(0)
摘要:
local tab= { [1] = "a", [3] = "b", [4] = "c" } for i,v in pairs(tab) do -- 输出 "a" ,"b", "c" , print( tab[i] ) end for i,v in ipairs(tab) do -- 输出 "a" ,k=2时断开 print( tab[...
阅读全文
posted @ 2018-11-22 11:48
anobscureretreat
阅读(202)
推荐(0)
摘要:
泛型 for 迭代器 输出 无状态的迭代器 输出 多状态的迭代器 输出
阅读全文
posted @ 2018-11-22 11:47
anobscureretreat
阅读(220)
推荐(0)
posted @ 2018-11-22 11:13
anobscureretreat
阅读(166)
推荐(0)
摘要:
function trim(s) return (string.gsub(s, "^%s*(.-)%s*$", "%1")) end string1 = " RUNOOB " string2 = trim(string1) print(string2)
阅读全文
posted @ 2018-11-22 11:13
anobscureretreat
阅读(431)
推荐(0)
摘要:
local function NumToCN(num) local size = #tostring(num) local CN = "" local StrCN = {"一","二","三","四","五","六","七","八","九"} for i = 1 , size do CN = CN .. StrCN[tonumber(strin...
阅读全文
posted @ 2018-11-22 11:12
anobscureretreat
阅读(1091)
推荐(0)
摘要:
字符串或串(String)是由数字、字母、下划线组成的一串字符。 Lua 语言中字符串可以使用以下三种方式来表示: 单引号间的一串字符。 双引号间的一串字符。 [[和]]间的一串字符。 示例 输出 string.upper(argument):字符串全部转为大写字母 string.lower(arg
阅读全文
posted @ 2018-11-22 10:19
anobscureretreat
阅读(309)
推荐(0)
摘要:
import json,time # save data to json file def store(data): with open('data.json', 'w') as fw: # 将字典转化为字符串 # json_str = json.dumps(data) # fw.write(json_str) # 上面...
阅读全文
posted @ 2018-11-22 00:34
anobscureretreat
阅读(236)
推荐(0)
摘要:
提示说是解码错误 可以用下面的方法判断json文件是否为空 但是在非空情况下会报错!!! 已解决!!!https://www.cnblogs.com/sea-stream/p/10011699.html
阅读全文
posted @ 2018-11-22 00:25
anobscureretreat
阅读(1916)
推荐(0)
posted @ 2018-11-21 23:48
anobscureretreat
阅读(582)
推荐(0)
posted @ 2018-11-21 23:36
anobscureretreat
阅读(1376)
推荐(0)
posted @ 2018-11-21 23:13
anobscureretreat
阅读(2132)
推荐(0)
摘要:
from datetime import date a = date(2001,2,18) b = date(2001,2,28) print(b-a)
阅读全文
posted @ 2018-11-21 10:30
anobscureretreat
阅读(324)
推荐(0)
摘要:
d1 = {'a': 100, 'b': 200} d2 = {'x': 300, 'y': 200} d = d1.copy() d.update(d2) print(d)
阅读全文
posted @ 2018-11-20 19:53
anobscureretreat
阅读(292)
推荐(0)
摘要:
Windows端: https://github.com/shadowsocks/shadowsocks-windows/releases Android端: https://github.com/shadowsocks/shadowsocks-android/releases iOS端: http
阅读全文
posted @ 2018-11-20 17:02
anobscureretreat
阅读(6)
推荐(0)
posted @ 2018-11-20 15:03
anobscureretreat
阅读(4765)
推荐(0)
摘要:
adb shell pm list packages adb start-server adb kill-server adb uninstall com.tencent.mm adb pull /sdcard/mm.txt D:\(讲内存卡根目录的txt文件copy到D盘根目录) adb push
阅读全文
posted @ 2018-11-20 11:57
anobscureretreat
阅读(191)
推荐(0)
摘要:
my_dict = {'data1':100,'data2':-54,'data3':247} print(sum(my_dict.values()))
阅读全文
posted @ 2018-11-20 10:06
anobscureretreat
阅读(5932)
推荐(0)
摘要:
color_dict = {'red':'#FF0000', 'green':'#008000', 'black':'#000000', 'white':'#FFFFFF'} for key in sorted(color_dict): print("%s: %s" % (key, color_di...
阅读全文
posted @ 2018-11-20 10:02
anobscureretreat
阅读(169)
推荐(0)