You can load this machine by clicking on the "My machines" button
def verificar_archivo_corrupto(file_path): try: # Intentar abrir el archivo con python-docx document = Document(file_path) print("El archivo no está corrupto") return False except Exception as e: print(f"El archivo está corrupto: {e}") return True
¡Eso suena como un proyecto interesante! Un generador de archivos corruptos de Word verificados podría ser una herramienta útil para probar la resiliencia de los sistemas de procesamiento de documentos de Word. A continuación, te presento una posible implementación de esta herramienta en Python: generador de archivos corruptos word verified
# Agregar un párrafo con texto aleatorio paragraph = document.add_paragraph() paragraph.add_run('Este es un documento de Word corrupto') generador de archivos corruptos word verified
def main(): file_path = 'documento_corrupto.docx' generar_archivo_corrupto(file_path) if verificar_archivo_corrupto(file_path): print("Archivo corrupto generado correctamente") else: print("Error: el archivo no está corrupto") generador de archivos corruptos word verified
This action cannot be undone.
This action cannot be undone.
You can load this machine by clicking on the "My machines" button
As a teacher I wanted to give assignments to my students, but (IMHO) the available simulators were not intuitive enough. We worked out the first version of this simulator with José Antonio Matte, an engineering student at PUC Chile. The simulator was functional but a bit unstable, so I created this second version. Please let me know if the simulator is being used in new institutions. If you find any bugs or have comments feel free to contact me.
def verificar_archivo_corrupto(file_path): try: # Intentar abrir el archivo con python-docx document = Document(file_path) print("El archivo no está corrupto") return False except Exception as e: print(f"El archivo está corrupto: {e}") return True
¡Eso suena como un proyecto interesante! Un generador de archivos corruptos de Word verificados podría ser una herramienta útil para probar la resiliencia de los sistemas de procesamiento de documentos de Word. A continuación, te presento una posible implementación de esta herramienta en Python:
# Agregar un párrafo con texto aleatorio paragraph = document.add_paragraph() paragraph.add_run('Este es un documento de Word corrupto')
def main(): file_path = 'documento_corrupto.docx' generar_archivo_corrupto(file_path) if verificar_archivo_corrupto(file_path): print("Archivo corrupto generado correctamente") else: print("Error: el archivo no está corrupto")