Python

How to define a simple Python function

def func_name(): print("test")

Execute a Python script with arguments

The script - args.py #!/usr/bin/python import sys index = 0 print('Number of arguments: ' + str(len(sys.argv)) + ' arguments.') for argument in sys.argv: print("sys.argv[" + str(index) + "]: " + str(argument)) index += 1 Execution python args.py working with arguments result Num...

Convert Unix timestamp to date

Python script from datetime import datetime converted_to_date = datetime.utcfromtimestamp(1575389290) # print result print(converted_to_date) # convert date format print(converted_to_date.strftime("%d.%m.%Y %H:%M:%S"))) output 2019-12-03 16:08:10 03.12.2019 16:08:10 The unix timestamp is...