Saltar al contenido

Tu sitio web

Registro
¿Has olvidado tu contraseña?

[python] 

[python]

Entradas recientes

  • Hello world!

Comentarios recientes

  • A WordPress Commenter en Hello world!
'hello.py' ), $attributes ); $handle = popen( __DIR__ . '/' . $data['file'], 'r'); $read = fread($handle, 2096); pclose($handle); return $read; }

'hola.py'
],
$attributes
);

$handle = popen( __DIR__ . '/' . $data['file'], 'r' );
$read = '';

while ( ! feof( $handle ) )
{
$read .= fread( $handle, 2096 );
}

pclose( $handle );

return $read;
}

<?php # -*- coding: utf-8 -*-
/* Plugin Name: Python embedded */

add_shortcode( 'python', 'embed_python' );

function embed_python( $attributes )
{
    $data = shortcode_atts(
        [
            'file' => 'hola.py'
        ],
        $attributes
    );

    $handle = popen( __DIR__ . '/' . $data['file'], 'r' );
    $read = '';

    while ( ! feof( $handle ) )
    {
        $read .= fread( $handle, 2096 );
    }

    pclose( $handle );

    return $read;
}
'hello.py' ], $attributes ); $handle = popen( __DIR__ . '/' . $data['file'], 'r' ); $read = ''; while ( ! feof( $handle ) ) { $read .= fread( $handle, 2096 ); } pclose( $handle ); return $read; }

[python file="hello.py"]

Funciona gracias a WordPress.