How to write a small python program on CentOS and RHEL 6/7 step by step guide


How to write a small python program on CentOS and RHEL 6/7  step by step guide


In this article we will learn how to write a small python program on linux system and how to execute this program using python.

Before write a python program we need to check two things.

1)First we need to install python on the system.


2)we need to check python binaries is installed on the system or not. To verify this we need to execute the below commands.

[root@localhost ~]# which python
/usr/bin/python
[root@localhost ~]# whereis python
python: /usr/bin/python2.6 /usr/bin/python /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz

Write  a small program using python

First we need to create one file named test.py and enter the below code  .

#!/usr/bin/python
print (" WELCOME TO TECHRIDERADMIN")

How to execute the python progam

To execute the python program we need to execute the below command.

[root@localhost ~]# python test.py
 WELCOME TO TECHRIDERADMIN
How to write a small python program on CentOS and RHEL 6/7  step by step guide
How to write a small python program on CentOS and RHEL 6/7  step by step guide


That’s all. If this article is helpful please share it!!!!




SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

1 comments: