xumu_iotdb/clientId_gen.py

22 lines
578 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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):
generated_id = "farm_" + generate_id(str(i))
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=",")