Closed vahidvdn closed 7 years ago
here is example usage, converting a python file in the tests directory to php.
$ cd py2php/tests
$ ../py2php file.py > file.php
$ cat file.php <?php set_include_path(get_include_path() . PATH_SEPARATOR . dirname(FILE) . DIRECTORY_SEPARATOR . 'libpy2php'); require_once('libpy2php.php'); require_once( 'os.php'); $f_in = pyjslib_open('file.py'); $outfile = '/tmp/file.py.test'; $f_out = pyjslib_open($outfile, 'w'); $lines = $f_in->readlines(); $f_out->writelines(array_slice($lines, null, 4)); pyjslib_printnl($f_out->closed); $f_in->close(); $f_out->close(); pyjslib_printnl($f_out->closed); pyjslib_printnl('---'); $f_iter = pyjslib_open('/tmp/file.py.test'); foreach( $f_iter as $line ) { pyjslib_print($line); } pyjslib_printnl('---'); $f_iter->seek(20); pyjslib_printnl($f_iter->read(10)); os::remove($outfile);
On 02/06/2017 12:02 AM, vahid najafi wrote:
Hi. Is there any example about the usage? I'm a php developer , and I know nothing about python. I have a python script, that I want to convert it to the |php|.
Any help would be appreciated.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dan-da/py2php/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AE37QHq6UBgbVgiLopUCsn7GNIH-sCHvks5rZtOUgaJpZM4L3340.
-- Dan Libby
Open Source Consulting S.A. Santa Ana, Costa Rica http://osc.co.cr phone: 011 506 2204 7018 Fax: 011 506 2223 7359
Hi. Is there any example about the usage? I'm a php developer , and I know nothing about python. I have a python script, that I want to convert it to the
php
.Any help would be appreciated.