xxxxxxxxxx
import subprocess
# Example: List files in the current directory
result = subprocess.run(['ls', '-l'], stdout=subprocess.PIPE, text=True)
# Print the output
print(result.stdout)
image.mefiz.com
xxxxxxxxxx
logging.basicConfig(filename="logfilename.log", level=logging.INFO)
# Log Creation
logging.info('your text goes here')
logging.error('your text goes here')
logging.debug('your text goes here')
xxxxxxxxxx
import logging
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
logging.error('And non-ASCII stuff, too, like Øresund and Malmö')
xxxxxxxxxx
import logging
# Set up the logger
logging.basicConfig(level=logging.DEBUG)
# Log messages
logging.debug("Debug message")
logging.info("Info message")
logging.warning("Warning message")
logging.error("Error message")
logging.critical("Critical message")
xxxxxxxxxx
# Python program explaining
# log() function
import numpy as np
in_array = [1, 3, 5, 2**8]
print ("Input array : ", in_array)
out_array = np.log(in_array)
print ("Output array : ", out_array)
print("\nnp.log(4**4) : ", np.log(4**4))
print("np.log(2**8) : ", np.log(2**8))
xxxxxxxxxx
def log(x,base):
result = ln(x)/ln(base)
return result
def ln(x):
n = 100000.0
return n * ((x ** (1/n)) - 1)
print(log(2,4))
#code by fawlid