ZhangZhihui's Blog  
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 78 下一页

2024年7月30日

摘要: Class methods allow us to define alternative initializers (also known as factory methods) in a class. These methods help us create instance objects fr 阅读全文
posted @ 2024-07-30 16:32 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: os.getcwd() Returns the path of the current working directory os.chdir(path) Changes our current working directory 阅读全文
posted @ 2024-07-30 15:49 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: The print function can also be used to write to a file. The output of print, that is by default, sent to the screen can be redirected to an open file. 阅读全文
posted @ 2024-07-30 15:12 ZhangZhihuiAAA 阅读(7) 评论(0) 推荐(0) 编辑
 
摘要: 'r' - read mode(default) 'w' - write mode 'a' - append mode 'x' - exclusive creation We know that the mode 'r' opens an existing file for reading only 阅读全文
posted @ 2024-07-30 14:45 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: Each module is loaded into memory only once during an interpreter session or during a program run, regardless of the number of times it is imported in 阅读全文
posted @ 2024-07-30 11:37 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: def func(s:str, i:int, j:int) -> str: return s[i:j] The parameter s is supposed to be a string, so we place a colon after the parameter name and then 阅读全文
posted @ 2024-07-30 11:17 ZhangZhihuiAAA 阅读(3) 评论(0) 推荐(0) 编辑
 
摘要: Parameters in Function Definition A. def func(name): Match by position or by name B. def func(name=value): Default argument C. def func(*args): Collec 阅读全文
posted @ 2024-07-30 11:06 ZhangZhihuiAAA 阅读(8) 评论(0) 推荐(0) 编辑

2024年7月29日

摘要: Unlike some other languages, in Python, the logical operators "and" and "or" do not return Boolean values True or False; they actually return the last 阅读全文
posted @ 2024-07-29 21:06 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: To select a random item from the list or shuffle the list, you can use the choice and shuffle functions from the random module of the standard library 阅读全文
posted @ 2024-07-29 20:05 ZhangZhihuiAAA 阅读(10) 评论(0) 推荐(0) 编辑

2024年7月2日

摘要: 阅读全文
posted @ 2024-07-02 11:40 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 78 下一页