ZhangZhihui's Blog |
|
||
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 阅读全文
摘要:
os.getcwd() Returns the path of the current working directory os.chdir(path) Changes our current working directory 阅读全文
摘要:
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. 阅读全文
摘要:
'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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
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 阅读全文
摘要:
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 阅读全文
2024年7月2日
摘要:
阅读全文
|
Copyright © 2024 ZhangZhihuiAAA
Powered by .NET 9.0 on Kubernetes |