page_count = 1000 for pg in range(1000): query_sql = f"""select * from xiaohongshu_comment_note_2 limit {page_number * page_count}, {page_count};""" cursor.execute(query_sql) for results in cursor.fetchall_unbuffered(): print(results)
当然还可以在函数中这样写
1 2 3 4 5 6 7 8 9 10 11 12 13 14
defunbuffer_query(page_count=1000, max_page=1000): """ :param page_count: :param max_page: :return: """ for page_number in range(max_page): query_sql = f"""select * from xiaohongshu_comment_note_2 limit {page_number * page_count}, {page_count};""" cursor.execute(query_sql) yieldfrom cursor.fetchall_unbuffered()
for i in unbuffer_query(page_count=999, max_page=9999): print(i)
Set oShell = CreateObject("WScript.Shell") Set oFS = CreateObject("Scripting.FileSystemObject") sHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%") sJBDataFolder = oShell.ExpandEnvironmentStrings("%APPDATA%") + "\JetBrains"
Set re = NewRegExp re.Global = True re.IgnoreCase = True re.Pattern = "\.?(IntelliJIdea|GoLand|CLion|PyCharm|DataGrip|RubyMine|AppCode|PhpStorm|WebStorm|Rider).*"
Sub removeEval(ByVal file, ByVal sEvalPath) bMatch = re.Test(file.Name) IfNot bMatch Then ExitSub EndIf
If oFS.FolderExists(sEvalPath) Then oFS.DeleteFolder sEvalPath, True EndIf EndSub
If oFS.FolderExists(sHomeFolder) Then ForEach oFile In oFS.GetFolder(sHomeFolder).SubFolders removeEval oFile, sHomeFolder + "\" + oFile.Name + "\config\eval" Next EndIf
If oFS.FolderExists(sJBDataFolder) Then ForEach oFile In oFS.GetFolder(sJBDataFolder).SubFolders removeEval oFile, sJBDataFolder + "\" + oFile.Name + "\eval" Next EndIf
yarn config set registry https://registry.npm.taobao.org -g yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
yarn使用
1 2 3 4 5 6 7 8 9 10 11 12 13
# 初始化项目 yarn init [-y] # 添加依赖 yarn [global] add -D, --dev save package to your `devDependencies`(开发依赖) -P, --peer save package to your `peerDependencies`(对等依赖) -O, --optional save package to your `optionalDependencies`(可选依赖) # 安装项目所有依赖 `yarn` or yarn install [--update-checksums] # 更新 yarn upgrade # 移除 yarn remove
# 连接设备(当只有只有一台设备的时候可以为空,当有多台设备可以是设备号或ip地址) device = u2.connect() # get uiautomator2 device info pprint(device.info) # get device info pprint(device.device_info) # get device windows size print(device.window_size()) # get device wlan ip pprint(device.wlan_ip) # get serial id pprint(device.serial)
d.screen_on() # turn on the screen d.screen_off() # turn off the screen
Press hard/soft key
1 2 3
d.press("home") # press the home key, with key name d.press("back") # press the back key, with key name d.press(0x07, 0x02) # press keycode 0x07('0') with META ALT(0x02)
These key names are currently supported:
home、back、
left、right、up、down
center、menu、search
enter、delete ( or del)
recent (recent apps)
volume_up、volume_down、volume_mute
camera、power
Click on the screen
1
d.click(x, y)
Double click
1 2
d.double_click(x, y) d.double_click(x, y, 0.1) # default duration between two click is 0.1s
long_click
1 2
d.long_click(x, y) d.long_click(x, y, 0.5) # long click 0.5s (default)
# swipe from point(x0, y0) to point(x1, y1) then to point(x2, y2) # time will speed 0.2s bwtween two points # swipe_points(self, points, duration: float = 0.5) d.swipe_points([(x0, y0), (x1, y1), (x2, y2)], 0.2))
注意:使用上述任何一种策略,当没有合适的键用于驱逐时,Redis 将在需要更多内存的写操作时返回错误。这些通常是创建新密钥、添加数据或修改现有密钥的命令。一些示例是:SET、INCR、HSET、LPUSH、SUNIONSTORE、SORT(由于 STORE 参数)和 EXEC(如果事务包括任何需要内存的命令)。
// 配置文件读取异常处理 if err := viper.ReadInConfig(); err != nil { if _, ok := err.(viper.ConfigFileNotFoundError); ok { // Config file not found; ignore error if desired log.Println("no such config file") } else { // Config file was found but another error was produced log.Println("read config error") } log.Fatal(err) // 读取配置文件失败致命错误 }
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel Level = iota // FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel // TraceLevel level. Designates finer-grained informational events than the Debug. TraceLevel )
// log.SetFormatter(&logrus.TextFormatter{ // DisableColors: false, // FullTimestamp: true, // }) type TextFormatter struct { // Set to true to bypass checking for a TTY before outputting colors. ForceColors bool
// Force disabling colors. DisableColors bool
// Force quoting of all values ForceQuote bool
// DisableQuote disables quoting for all values. // DisableQuote will have a lower priority than ForceQuote. // If both of them are set to true, quote will be forced on all values. DisableQuote bool
// Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/ EnvironmentOverrideColors bool
// Disable timestamp logging. useful when output is redirected to logging // system that already adds timestamps. DisableTimestamp bool
// Enable logging the full timestamp when a TTY is attached instead of just // the time passed since beginning of execution. FullTimestamp bool
// TimestampFormat to use for display when a full timestamp is printed. // The format to use is the same than for time.Format or time.Parse from the standard // library. // The standard Library already provides a set of predefined format. TimestampFormat string
// The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool
// The keys sorting function, when uninitialized it uses sort.Strings. SortingFunc func([]string)
// Disables the truncation of the level text to 4 characters. DisableLevelTruncation bool
// PadLevelText Adds padding the level text so that all the levels output at the same length // PadLevelText is a superset of the DisableLevelTruncation option PadLevelText bool
// QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool
// Whether the logger's out is to a terminal isTerminal bool
// FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &TextFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message"}} FieldMap FieldMap
// CallerPrettyfier can be set by the user to modify the content // of the function and file keys in the data when ReportCaller is // activated. If any of the returned value is the empty string the // corresponding key will be removed from fields. CallerPrettyfier func(*runtime.Frame)(function string, file string)
terminalInitOnce sync.Once
// The max length of the level text, generated dynamically on init levelTextMaxLength int }
// log.SetFormatter(&logrus.JSONFormatter{}) type JSONFormatter struct { // TimestampFormat sets the format used for marshaling timestamps. // The format to use is the same than for time.Format or time.Parse from the standard // library. // The standard Library already provides a set of predefined format. TimestampFormat string
// DisableTimestamp allows disabling automatic timestamps in output DisableTimestamp bool
// DisableHTMLEscape allows disabling html escaping in output DisableHTMLEscape bool
// DataKey allows users to put all the log entry parameters into a nested dictionary at a given key. DataKey string
// FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &JSONFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message", // FieldKeyFunc: "@caller", // }, // } FieldMap FieldMap
// CallerPrettyfier can be set by the user to modify the content // of the function and file keys in the json data when ReportCaller is // activated. If any of the returned value is the empty string the // corresponding key will be removed from json fields. CallerPrettyfier func(*runtime.Frame)(function string, file string)
// PrettyPrint will indent all json logs PrettyPrint bool }