xumu_iotdb/clientId_gen.py

22 lines
578 B
Python
Raw Normal View History

2024-01-26 14:18:00 +08:00
import uuid
import pandas as pd
def generate_id(name):
# 生成一个UUID
unique_id = str(uuid.uuid5(uuid.NAMESPACE_URL, name)).replace("-", "")[:12]
# 将UUID转换为字符串并添加指定的前缀
return unique_id
clientId = []
uuid_version = []
name = []
for i in range(50):
2024-01-26 14:36:35 +08:00
generated_id = "farm_" + generate_id(str(i))
2024-01-26 14:18:00 +08:00
name.append(str(i))
uuid_version.append("uuid5")
clientId.append(generated_id)
df = pd.DataFrame({"clientId": clientId, "name": name, "uuid_version": uuid_version})
df.to_csv("clientId.csv", index=False, sep=",")