In fifth part of our Python blog entry i will write my own script.
This script will provide us with the port information of any Linux service.
Also you will see a touch of socket programming in python. Enjoy !
I have named this script as porter.
In fifth part of our Python blog entry i will write my own script.
This script will provide us with the port information of any Linux service.
Also you will see a touch of socket programming in python. Enjoy !
I have named this script as porter.
Simple Python Script which will show linux logs (dmesg and lastlog) from selection.
#!/usr/bin/env python
import os
os.system (‘clear’)
print “Pylog Created by Hyp3ri0n”
print “Version 0.1”
print “Respect Linux…………….”
print “=” * 50
print ” ”
value = 1
value2 = 2
answer = int(input (“Enter the Value 1 or 2: “)
if answer == value:
os.system (‘tail -20 /var/log/dmesg’)
if anwer == value2:
os.system (‘lastlog -u 0 && lastlog -u 1001-10000’)
#End
The IF & ELIF Statement
Let’s Write Our First Program using if and elif statement.
Open Vi editior as
# vi pyif.py
and Start Typing the below code:
In this part we will continue our journey with Python.
Note that every thing in Python is an Object and it has a unique id and it has a type e.g
>>> x = 2
>>> id(x)
505498008
They Article is a quick Python Learning guide so hang onto your seat belts and ride along !!
PYTHON
In Linux type python and it will start python.
>>> is the python prompt Continue reading