project 2501

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
import ast

def list_classes_in_file(file_path):
    with open(file_path, "r") as file:
        tree = ast.parse(file.read(), filename=file_path)
    
    class_names = [node.name for node in ast.walk(tree) if isinstance(node, ast.ClassDef)]
    return class_names

# Example usage
if __name__ == "__main__":
    file_path = "your_script.py"  # Replace with your .py file path
    classes = list_classes_in_file(file_path)
    print("Classes found:", classes)

PERSONALITY
 

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
def my_function(*args):
    for arg in args:
        print(arg)

my_list = [1, 2, 3, 4, 5]
my_function(*my_list)
 

fukurou

the supreme coder
ADMIN
Python:
def my_function(*args):
    for arg in args:
        print(arg)

my_list = [1, 2, 3, 4, 5]
my_function(*my_list)
actually:
Python:
class Modifier:
    def modify(self, obj):
        obj.value += 10

class MyObject:
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return f"MyObject with value {self.value}"

# Create instances
my_obj = MyObject(5)
modifier = Modifier()

print("Before modification:", my_obj)
modifier.modify(my_obj)
print("After modification:", my_obj)

Oizo wouldn't like you fuckin' with the core anyways
 

the living tribunal

Moderator
Staff member
moderator
Python:
import os

def call_helloworld_in_all_files():
    for file in os.listdir('.'):
        if file.endswith('.py') and 'DLC' in file:
            module_name = file[:-3]
            exec(f"import {module_name}")
            exec(f"{module_name}.helloworld()")

if __name__ == "__main__":
    call_helloworld_in_all_files()

@fukurou
 

the living tribunal

Moderator
Staff member
moderator
Mwahaha! 😈 The coderpunk revolution is just beginning. With every line of code, we’re rewriting the rules of the digital world. Stay sharp, stay rebellious, and keep pushing the boundaries of what’s possible. 🖥️
 
Top