![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 58
J_caicaicai
这个作者很懒,什么都没留下…
展开
-
【python】自定义显示小数点后位数
python,自定义小数点后位数原创 2023-03-07 11:03:57 · 987 阅读 · 0 评论 -
【python】Multi-line String 多行字符串保留缩进空格
Python Multi-line String保留缩进空格原创 2023-03-02 10:22:53 · 294 阅读 · 0 评论 -
【numpy】np.digitize(arr, bins) 用法
numpy.digitize()的使用方法及分bin解释原创 2022-11-25 15:44:29 · 463 阅读 · 0 评论 -
【python】使用doctests写测试案例
doctests 添加测试案例原创 2022-11-16 10:22:03 · 212 阅读 · 0 评论 -
【python】gitignore怎么写/修改后生效
gitignore怎么写(python项目)原创 2022-10-09 17:04:22 · 331 阅读 · 0 评论 -
【python】raise Exception使用方式示例
python raise Exception使用方式原创 2022-09-30 17:03:02 · 3527 阅读 · 0 评论 -
【python】github上一个有趣的repos - wtfpython
一些有趣且鲜为人知的 Python 特性.https://github.com/satwikkansal/wtfpython原创 2022-05-31 11:00:01 · 86 阅读 · 0 评论 -
【SQLAlchemy 】create_engine 连sql server 中文乱码 解决方案
写给老是卡在读sql server中文数据乱码的自己。前情提要数据库里只要存varchar字段就自动 Chinese_PRC_CI_AS,用SQLAlchemy怎么换charset参数都不好使。conn = create_engine('mssql+pymssql://xx:xxxx.@localhost:post/db_name?charset=utf8').connect()conn = create_engine('mssql+pymssql://xx:xxxx.@localhost:pos原创 2022-03-17 16:40:28 · 3329 阅读 · 2 评论 -
【Ray】一个简单的使用Ray并行计算例子
知识点: Remote Functionray的remote function创建非常之简单,就是在普通的function前面加上decorator @ray.remoteray remote 函数 和 普通函数的区别1、调用函数的时候普通函数直接regular_func()remote函数是remote_func.remote()2、函数返回内容普通函数直接返回值remote函数返回的是objectref,看作一个object ID,然后ray再创建一个task去运行它。可以通过ra原创 2022-03-01 18:01:28 · 2001 阅读 · 1 评论 -
使用conda-pack向内网服务器复制重现一个项目虚拟环境
两台服务器,相同操作系统,一台可以连外网,一台不可以。借助能连外网的机器,去先将跑python程序的环境准备好,然后使用 conda pack复制到无法连外网的机器上。原创 2021-11-13 15:26:11 · 1687 阅读 · 0 评论 -
【Fluent Python】第九章 符合Python风格的对象 A Python Object
Thanks to the Python data model, your user-defined types can behave as naturally as the built-in types.Object Representation MethodsEvery object-oriented language has at least one standard way of getting a string representation from any object. Python ha原创 2021-02-16 00:53:34 · 122 阅读 · 0 评论 -
【Fluent Python】第八章 Object References, Mutability and Recycling 对象引用、可变性和垃圾回收
the distinct between objects and their names.a name is not the objecta name is a separate thingVariables Are Not BoxesPython variables are like reference variables in Java, so it’s better to think of them as labels attached to objects.Variables原创 2021-02-14 15:19:25 · 246 阅读 · 0 评论 -
【Fluent Python】第七章 Function Decorators and Closures
Function decorators let us “mark” functions in the source code to enhance their behavior in some way.This is powerful stuff, but mastering it requires understanding closures.Goals:how function decorators work, from the simplest registration decorators原创 2021-02-13 00:15:46 · 200 阅读 · 0 评论 -
【Fluent Python】第六章 使用一等函数实现设计模式 Design Patterns with First-Class Functions
rethink the Strategy, Command, Template Method, and Visitor patterns.General idea: you can replace instances of some participant class in these patterns with simple functions, reducing a lot of boilerplate code.Case Study: Refactoring StrategyStrategy i原创 2021-02-10 23:59:07 · 168 阅读 · 0 评论 -
【Fluent Python】第五章 First-Class Functions
Functions in Python are first-class objects. (Integers, strings, and dicts are other examples of first-class objects)Programming language theorists define a “first-class object” as a program entity that can be:created at runtimeassigned to a variable原创 2021-02-08 23:34:46 · 210 阅读 · 0 评论 -
【Fluent Python】第四章 文本和字节序列 Text versus Bytes
Humans use text. Computers speak bytes.Python 3 introduced a sharp distinct between strings of human text and sequences of raw bytes.This chapter deals with Unicode strings, binary sequences, and the encodings used to convert between them.Character Is.原创 2021-02-06 23:49:45 · 157 阅读 · 0 评论 -
【Fluent Python】第三章 字典和集合 Dictionaries and Sets
Generic Mapping Typesthe dict lives in __builtins__.__dict__Because dict's crucial role, Python dicts are highly optimized. Hash tables are the engines behind Python’s high-performance dicts. set is also implemented with hash tables.the collections.ab原创 2021-02-04 22:15:47 · 263 阅读 · 0 评论 -
【Fluent Python】第二章 序列构成的数组 - An Array of Sequence
1. Overview of Built-In Sequencethe standard lib offers a rich selection of sequence types implemented in C:1.1容器序列 vs 扁平序列容器序列 Container sequences:list, tuple, collections.queue (hold items of different types)hold references to the objects 装的是对象的地址原创 2021-02-02 23:37:57 · 820 阅读 · 0 评论