# Python_excercise **Repository Path**: al666ex/Python_excercise ## Basic Information - **Project Name**: Python_excercise - **Description**: Python 练习。练习python - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2023-10-01 - **Last Updated**: 2023-10-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #### 一些练习小程序,所有的代码在vscode 1.82.2 下测试通过,windows 10 64位系统, python 3.11.5 - [batch_file_rename.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/batch_file_rename.py) - 此小程序批量重命令当前文件夹下文件,将py程序放置于需要重命名的文件夹下,运行程序即可批量重命名 ```bash D:\git >python batch_file_rename.py doc docx Rename is done! ['1.docx', '3.docx', '5.docx'] D:\git > ``` - [create_dir_if_not_there.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/create_dir_if_not_there.py) - 检查用户文件夹下是否有对应名字文件夹,如果没有,则新建一个。 ```bash D:\git\Python_excercise\excercise>python create_dir_if_not_there.py C:\Users\Administrator The directory "test_dir" was created. ``` - [dir_test.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/dir_test.py) - 检查当前目录是否存在输入的文件夹,如果没有按你的意愿选择是否新建文件夹 ```bash D:\git\Python_excercise\excercise>python dir_test.py Enter the name of the directory to check : estt No directory found for estt Would you like this directory create? y/n: y Directory created for estt ``` - [env_check.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/env_check.py) - 打印当前所有环境变量 - [blackjack.py](https://github.com/Ratna04priya/Python/blob/master/BlackJack_game/blackjack.py) - This script contains the Casino BlackJack-21 Game in Python. - [file_info.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/fileinfo.py) - 展示指定文件信息 - [folder_size.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/folder_size.py) - 显示与py文件处于同一级目录内的一个文件夹大小. ```bash D:\git\Python_excercise\excercise>python folder_size.py test 文件夹大小: 15722.00 B 文件夹大小: 15.35 KB 文件夹大小: 0.01 MB 文件夹大小: 0.00 GB ``` - [logs.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/logs.py) - This script will search for all `*.log` files in the given directory, zip them using the program you specify, and then date stamp them. - [move_files_over_x_days.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/move_files_over_x_days.py) - 移动所有文件,从[源文件夹]->[目标文件夹],只要日期大于24天(默认)或输入的天数。 - [nslookup_check.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/nslookup_check.py) - This simple script opens the file `server_list.txt` and then does a nslookup for each one to check the DNS entry. - [os_info.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/osinfo.py) - 显示一些系统信息 ```bash D:\git\Python_excercise\excercise>python os_info.py architecture : ('64bit', 'WindowsPE') freedesktop_os_release: ('64bit', 'WindowsPE') machine : AMD64 node : PC-20221018RATM platform : Windows-10-10.0.19044-SP0 processor : Intel64 Family 6 Model 69 Stepping 1, GenuineIntel python_build : ('main', 'Sep 11 2023 13:26:23') python_compiler : MSC v.1916 64 bit (AMD64) python_implementation: CPython python_version : 3.11.5 python_version_tuple: ('3', '11', '5') release : 10 system : Windows system_alias : Windows version : 10.0.19044 win32_edition : EnterpriseS win32_is_iot : False win32_ver : ('10', '10.0.19044', 'SP0', 'Multiprocessor Free') ``` - [ping_servers.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/ping_servers.py) - This script, depending on the arguments supplied, will ping the servers associated with that application group. - [ping_subnet.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/ping_subnet.py) - After supplying the first 3 octets this file scans the final range for available addresses. - [powerdown_startup.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/powerdown_startup.py) - This file goes through the server list and pings the machine, if it is up it will load the putty session, if it is not then it will notify you. - [puttylogs.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/puttylogs.py) - This file zips up all the logs in the given directory. - [script_count.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/script_count.py) - This file scans the scripts directory and gives a count of the different types of scripts. - [get_youtube_view.py] - This is a simple python script used to get more views on your YouTube videos. This script may also be used to repeat songs on YouTube. - [script_listing.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/script_listing.py) - This file will list all the files in the given directory, and go through all the subdirectories as well. - [testlines.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/testlines.py) - This simple script opens a file and prints out 100 lines of whatever is the set for the line variable. - [tweeter.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/tweeter.py) - Allows you to tweet text or a picture from the terminal. - [serial_scanner.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/serial_scanner.py) contains a method called ListAvailablePorts which returns a list with the names of the serial ports that are in use in the computer. This method works only on Linux and Windows (can be extended for mac OS). If no port is found, an empty list is returned. - [CountMillionCharacter.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/CountMillionCharacter.py) And [CountMillionCharacter2.0](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/CountMillionCharacters-2.0.py).py - Gets character count of a text file. - [calculator.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/calculator.py) - Uses Python's eval() function to implement a calculator. - [Google_News.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/Google_News.py) - Uses BeautifulSoup to provide Latest news headline along with news link. - [SimpleStopWatch.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/SimpleStopWatch.py) - Simple Stop Watch implementation using Python's time module. - [Changemac.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/changemac.py) - This script change your MAC address , generate random MAC address or enter input as new MAC address in your Linux(Successfully Tested in Ubuntu 18.04). - [whatsapp-monitor.py](https://gitee.com/al666ex/Python_excercise/blob/master/excercise/whatsapp-monitor.py) - Uses Selenium to give online status about your contacts when your contacts become online in WA you will get an update about it on terminal.