比较两个数字的大小,包含正负数的情形
A, B
A, B 为实数A
A 比 B 大了多少(百分比):
[(A/B)-1]/[B/ABS(B)]
| from gtts import gTTS #updated 2024-06-19-081215 | |
| from pydub import AudioSegment | |
| import os | |
| def text_to_speech_with_pauses(text, lang='zh-CN', pause_duration=8000): | |
| segments = text.split(',') # Split text at comma | |
| combined = AudioSegment.silent(duration=0) # Start with an empty segment | |
| for segment in segments: | |
| tts = gTTS(text=segment, lang=lang) |
| import os | |
| import subprocess | |
| def extract_pages_from_pdf(source_file, page_range, output_file): | |
| try: | |
| subprocess.run(['pdftk', source_file, 'cat', page_range, 'output', output_file], check=True, capture_output=True, text=True) | |
| except subprocess.CalledProcessError as e: | |
| print(f"Error during 'pdftk' execution:\n{e.stderr}") | |
| exit(1) |
| import pandas as pd | |
| import numpy as np | |
| # Specify the path to your excel file | |
| file_path = 'list.xlsx' | |
| # Read the Excel file | |
| df = pd.read_excel(file_path) | |
| # Drop rows with missing values |
| # use index values, which are all Chinese characteres, as x labels, | |
| # but not enought space to display, so we need to display the characters vertically, | |
| # not jsut rotate x lables | |
| # but to display the characters one at each line. | |
| # reference & courtesy: https://blog.csdn.net/ai_clay/article/details/126038824 | |
| df_new=df_filtered.index # get the index values from the original df | |
| df_new= df_new.map(lambda x: '\n'.join(x)) # one character each line |
比较两个数字的大小,包含正负数的情形
A, B
A, B 为实数A
A 比 B 大了多少(百分比):
[(A/B)-1]/[B/ABS(B)]
rsync -a /source/directory --files-from=/full/path/to/listfile /destination/directoryexample:
rsync -a ./source --files-from=./list.txt ./new| #!/usr/bin/env python3 | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| see: https://gist.github.com/UniIsland/3346170 | |
| """ | |