https://github.com/kernel-loophole/python-version-2.o
updated
https://github.com/kernel-loophole/python-version-2.o
logging multithreading openpyxl programming proxy python python-script
Last synced: 4 months ago
JSON representation
updated
- Host: GitHub
- URL: https://github.com/kernel-loophole/python-version-2.o
- Owner: kernel-loophole
- Created: 2022-04-03T14:36:52.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T07:40:05.000Z (almost 3 years ago)
- Last Synced: 2025-03-18T03:29:29.232Z (7 months ago)
- Topics: logging, multithreading, openpyxl, programming, proxy, python, python-script
- Language: Python
- Homepage:
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# what's new in 2.o repo
# Match statement
work faster as compare to else if
```python
def check_match(string):
check_list=["abc","xyz","none","etc"]
for i in check_list:
match string:
case 'abc':
print("string is abc")
case 'xyz':
print("string is xyz")
case _:
print("string is not abc and xyz")
```
# Iter()
One useful application of the second form of iter() is to build a block-reader.
```python
from functools import partial
#One useful application of the second form of iter() is to build a block-reader.
# For example, reading fixed-width blocks from a binary database file until the end of file is reached:
with open("/home/hiader/Desktop/code/fruit_data_with_colors.txt","rb") as f:
for block in iter(partial(f.read,64),b''):
print(block)
print(locals())
print(globals())
```