This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('your_file.txt', 'r') as file: | |
paragraphs = file.read().split('$') | |
# Remove leading and trailing whitespace from each paragraph | |
paragraphs = [p.strip() for p in paragraphs] | |
# Remove duplicates while preserving order | |
unique_paragraphs = [] | |
seen = set() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def jeu_de_devinette(): | |
nombre_a_deviner = random.randint(1, 20) | |
essais = 0 | |
print("Bienvenue dans le jeu de devinette !") | |
print("Je pense à un nombre entre 1 et 20.") | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32com.client | |
import pandas as pd | |
import io | |
from datetime import datetime | |
# Connect to Outlook | |
outlook = win32com.client.Dispatch("Outlook.Application") | |
namespace = outlook.GetNamespace("MAPI") | |
# Recherche du dossier principal par son nom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let folder_path = "your_folder_path"; /* Specify the path to your folder */ | |
%let table_name = "xyz"; /* Specify the table name to search for */ | |
/* Create a fileref for the directory */ | |
filename dirlist "&folder_path" ; | |
/* Get a list of SAS program files in the folder */ | |
data sas_files; | |
length file_name $256.; | |
infile dirlist truncover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xlrd | |
# Open the workbook | |
workbook = xlrd.open_workbook('your_excel_file.xls') | |
# Select the first sheet | |
sheet = workbook.sheet_by_index(0) | |
# Iterate through rows and columns to read data | |
for row in range(sheet.nrows): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def populate_tree(tree, item, dictionary): | |
if isinstance(dictionary, dict): | |
for key, value in dictionary.items(): | |
if isinstance(value, dict): | |
sub_item = tree.insert(item, "end", text=key) | |
populate_tree(tree, sub_item, value) | |
else: | |
tree.insert(item, "end", text=key, values=(value,)) | |
else: | |
tree.insert(item, "end", values=(dictionary,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to find interdependent product groups | |
def find_interdependent_groups(transactions): | |
product_groups = [] | |
remaining_products = set() | |
# Get unique products | |
for products in transactions: | |
remaining_products |= products | |
transactions_copy = transactions.copy() # Create a copy of the list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Nov 29 15:02:06 2023 | |
@author: Lenovo | |
""" | |
nested_dict = { | |
'rule1': { | |
'name': 'xy1z11111', | |
'Reccurence': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
from tkinter import simpledialog, messagebox | |
class NestedDictManager: | |
def __init__(self, root): | |
self.root = root | |
self.root.title("Nested Dictionary Manager") | |
self.data = { | |
'key1': 'value1', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
from tkinter import simpledialog, messagebox | |
class NestedDictManager: | |
def __init__(self, root, data): | |
self.root = root | |
self.root.title("Nested Dictionary Manager") | |
self.data = data # Use the provided dictionary | |
self.tree = tk.ttk.Treeview(self.root) |
OlderNewer