Python output three ways: print output Python script to perform Linux direct execution

Source: Internet
Author: User
Tags python script

1. After installing Python in Linux, enter Python on the Linux command line to switch to the Python command line

2. print ' Hello world! ' = = Print ("Hello world!")

3. Write a python script and then execute the

For example: typing in text: print ' Hello word! '

Then save this file as a py file, for example: h.py

In a Linux environment, first switch the path to the file storage path, and then execute

4. Change the Python program to an executable file (file name: h.py), which can be executed directly:

File content: #! /usr/bin/env python

Print (' Hello world! ')

To execute a command in a Linux environment:

1. Switch to the execution file directory

2. Set the file to executable: chmod +x h.py

3. Execution of documents:./h.py

Python output three ways: print output Python script to perform Linux direct execution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.