Skip to content
Advertisement

Tag: python

Python expression equivalent to include() of PHP

Is there any expression in Python that is equivalent to ‘include()’ of PHP? To be more specific, I want to make in python a file for database connection and another for queries, but the variable for the connection only exists in the connection file. If it was in PHP I could use ‘include()’ to call the connection variable in another

Decompress LZString in Ruby

Is there any equivalent or open-source library for decompress using LZ String in Ruby ? Code in Python : Code in PHP : Answer Is there any equivalent or open-source library for decompress using LZ String in Ruby ? According to author of original (JavaScript) lz-string Here is a Ruby version, by Altivi: https://github.com/Altivi/lz_string

Why the encodings from sys.stdout.encoding show those two different results as following?

I have two code files which are “run_python.php” and “script.py”. run_python.pyp script.py When I run run_python.php, the output result on the browser is : When I run the script.py through the cmd(“python script.py”), the output result on the cmd is : Why the encodings from sys.stdout.encoding show those two different results? I’m guessing that they’re running on two different shells

Trying to run python script in PHP

I’m trying to run a Python script inside a perl script with the following command: On the operating system’s command line, the Python script executes, but when I make a call from a PHP application, the perl work, but the python script don’t work. Answer Do you get any error message from Perl side? Likely where your PHP/Perl script runs

How can I output values from an Excel table on my website?

In my Excel spreadsheet there are several values, both numbers and text. I would like to display these values on a web page inform of graphs. But I have no idea how to solve this, I thought of Python and PHP. I try to do it with HTML and it is impossible. Answer You can read the file using the

Why is cx_Oracle performing better than PHP OCI8?

I am trying to determine why a query that returns CLOB data runs so much faster using python3 and cx_Oracle in comparison to PHP 7.4 with OCI8. Oracle Client Libraries version is 19.5.0.0.0. Queries are ran on the same client and against the same database using the same user. See below for the test PHP and Python scripts. The PHP

Python bitshifting vs PHP bitshifting

I have a code in python which uses right bit shift and it returns the correct value but the same way I tried to shift right in PHP, it returns 0. Python code: PHP code: I have a very little experience in maths functions, would be great if someone can help. Answer This operator >> is working on an integer

How do I translate a PHP cURL request to python

I’m coding a tool to get Whois info, and I need to use the WHMCS API for it. This is the code they provide: I want to use this request without PHP, and inside Python. What library should I use and how do I set the variables in the payload?(php or python-style?) Answer What library should I use requests is

Advertisement