封装百度翻译 API, 翻译字符串或字符串列表
Project description
baidu translate
封装百度翻译 API,翻译字符串或字符串列表
示例
- 同步
from lzhbaidutranslate import baidu_translate
query = 'Hello World! This is 1st sentence. This is 2nd sentence.'
querys = ['Hello World! This is 1st sentence.','This is 2nd sentence.']
# Set your own appid/appkey.
appid = ""
appkey = ""
print(baidu_translate(appid, appkey, query)) # 翻译字符串
print(baidu_translate(appid, appkey, querys)) # 翻译字符串列表
- 异步
import asyncio
from lzhbaidutranslate import baidu_translate_async
query = 'Hello World! This is 1st sentence. This is 2nd sentence.'
querys = ['Hello World! This is 1st sentence.','This is 2nd sentence.']
# Set your own appid/appkey.
appid = ""
appkey = ""
async def main():
print(await baidu_translate_async(appid, appkey, query))
print(await baidu_translate_async(appid, appkey, querys))
asyncio.run(main())
安装 - PyPI
pip install lzhbaidutranslate
API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lzhbaidutranslate-1.1.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lzhbaidutranslate-1.1.tar.gz.
File metadata
- Download URL: lzhbaidutranslate-1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a185c3245e3396e720d0d4638c4a8b82ac9b9125b59e5b9d889fbe43d601cb
|
|
| MD5 |
8cfa90b2ef4b8f22547d4c0a442faaa8
|
|
| BLAKE2b-256 |
d26d432ebcadd5daf69eb1617fa25190aa819e397ee58fbbc440e6813664831b
|
File details
Details for the file lzhbaidutranslate-1.1-py3-none-any.whl.
File metadata
- Download URL: lzhbaidutranslate-1.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d0792b9927b49e74a67c028431aa0563698c8dc1bf5b6aadf369c36fbda8120
|
|
| MD5 |
11cc11d7e47b480ce2e82f1da679e99f
|
|
| BLAKE2b-256 |
20b672023811d9411fbca36432fd550c59fb36b7c89f3a07355cd84d99a0d12f
|