Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write hello world in python

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to write hello world in python". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to write hello world in python.

one。 Create the first hello world project 1.Create New Project using pycharm

2.pycharm sets the directory where the project is located (currently creating an empty project)

3. To add a python file, right-click untitled10 (Project folder)-> New-> Python File

4. Set the name of the created python file, click OK, and the project has been created. An additional helloworld.py file has been added to the untitled10 directory

The helloworld.py you just created is supposed to be a blank file with nothing, because I have configured a template for pycharm. Whenever you create a python file, the py file will automatically fill in my template content. If you also want to set up a template of your own, please refer to: Pycharm setting development template / font size / background color

The template code is as follows: (for specific settings, please refer to the hyperlink above)

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

thirteen

#! usr/bin/env python

#-*-coding:utf-8 _ *-

"

@ Author: how to solve the problem

Blog (personal blog address): shuopython.com

@ WeChat Official Account (official Wechat account): ape says python

@ Github:www.github.com

@ File:$ {NAME} .py

@ Time:$ {DATE} ${TIME}

@ Motto: if you don't accumulate steps, you can't reach thousands of miles. If you don't accumulate small streams, you can't become rivers and seas. The splendor of program life needs to be accumulated unremittingly.

"

two。 Write code

Python programming wants to achieve helloworld, the difficulty of operation can be called the level of hegemony.

I think it should be the simplest programming language. It only takes one line of code to implement helloworld.

one

Print ("hello world")

three。 Run the project

The question is: how does pycharm run the project?

Method 1: click the triangle green button to run (run the program)

Method 2: use the shortcut key Ctrl + shift + 10, the same effect, but also print hello world on the screen

Method 3: use the cmd command, open the cmd terminal, enter the directory where the project is located, and execute the command: python

Method 4: switch to the Terminal window, which is similar to the cmd operation

Method 5: switch to the Python Console window

Thank you for your reading, the above is the content of "python how to write hello world", after the study of this article, I believe you have a deeper understanding of how to write hello world in python, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report