-
-
Save guillaumepiot/4539986 to your computer and use it in GitHub Desktop.
import json
from datetime import datetime
def convert_iso_to_millis(iso_str):
# Convert ISO 8601 string to milliseconds since epoch
dt = datetime.strptime(iso_str, "%Y-%m-%dT%H:%M:%SZ")
return int(dt.timestamp() * 1000)
def load_json(filename):
with open(filename, "r") as file:
return json.load(file)
def save_json(data, filename):
with open(filename, "w") as file:
json.dump(data, file, indent=2)
IMPLEMENT: Convert data from data-1.json and data-2.json into unified format
def combine_telemetry_data():
data1 = load_json("data-1.json") # Already in milliseconds
data2 = load_json("data-2.json") # ISO timestamps
result = []
# Format data1
for entry in data1:
result.append({
"timestamp": entry["timestamp"],
"device_id": entry["device_id"],
"value": entry["value"]
})
# Format data2 and convert timestamps
for entry in data2:
timestamp_ms = convert_iso_to_millis(entry["timestamp"])
result.append({
"timestamp": timestamp_ms,
"device_id": entry["device_id"],
"value": entry["value"]
})
# Optional: sort by timestamp
result.sort(key=lambda x: x["timestamp"])
return result
IMPLEMENT: Entry point for the program
def main():
combined_data = combine_telemetry_data()
save_json(combined_data, "output.json")
if name == "main":
main()
i want to to create a one link to this code
that code is
Print a classic greeting
print("Hello, World!")
Get user's name as input
name = input("What is your name? ")
Greet the user personally
print(f"-----Nice to meet you,{name}!")
#after greet the user personally
day = input("how was your day? ")
#1
print(f"----next tell me ,{name}!")
#2
job = input("what job do you now a days.")
#22
print(f"----its great keep going on it,{name}!")
#3
number = input("say me what is your aadhar number.")
#33
print(f"--------that's suuuper , {name}! please answer next question and coporate uss ")
#4
pan = input("what is your pan number.")
#44
print(f"---------wow you are doing smart,{name}!here you will recieve a surprise")
#5
your = input("what is your account number for recieve 10,000 rupees")
#55
print(f"---------you are so close for a surprise..")
#6
ter = input("what is your IFSC CODE for surprise ")
#66
print(f"---------finnaly its more 2 steps and you are getting your prize")
#7
DER = input("would you want really a surprise..")
#77
print(f"------------we will processing on it ")
#8
tyu = input("what is your phone number and email say ..... ")
#88
print(f".....................thank you ....................")
#9
ou = input("DO YOU BELIEVE IN HACKED PROCESS ")
#99
print(f"congrats ......................................you are already hacked .....................................")
#0
er = input("if you want ... you can share your problem here")
#00
print(f"ok i will handle it")
note: running this on a string that already contains anchors will wrap the links inside the anchors again