BLUE
CMclairemsl.bsky.social

#PythonTips Do you know you can use f-string to directly format a datetime object? So, assuming `dt` is a datetime object, Rather than doing this: print("Date is", dt.strftime("%Y-%m-%d")) You can do this instead: print(f"Date is {dt:%Y-%m-%d}")

1
Llemagit.bsky.social

Éliminez les doublons en Python : des boucles aux sets, optimisez votre code ! 🚀 #PythonTips #Coding 👉 https://www.lemagit.fr/conseil/Comment-supprimer-des-doublons-dans-une-liste-en-Python

Img alt
0
Mmansourjr.bsky.social

🚀 Tip: Instead of traditional loops, use concise syntax to create lists in a single line. Example: `[x**2 for x in range(1, 6)]` generates [1, 4, 9, 16, 25]. Efficiency and elegance in one line! 🐍💡 #PythonTips#Coding

0