How to write the first line of python code
How to write the first line of python code, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
1. Create a new file
Under your project or under your own specified directory, create a new file named one.py.
Write the following in the file:
Print ("hello world")
Note: you can try to change the contents in quotation marks to something else.
two。 Run the code
Please run the code as before you are ready to start writing code in the directory of this book.
The running result is as follows, which is displayed in the development tool or on the command line:
Hello world
The result of the command line run is as follows:
The running result of the development tool is as follows:
3. Python function interpretation
4. Code interpretation description
Print refers to a function (syntax) of displaying, outputting and printing in Python language.
The main function of double quotation marks is to enclose the text to be displayed in double quotation marks.
Hello world is a sentence that I want to show. You can display any sentence that says: beijing Beijing is OK, too.
Change the content in the double quotation marks to something else, why don't you try it?
5. If you want to write in Chinese # coding=utf-8print ('Hello, World!')
Note:
The code part of Python should be written in English input method, not Chinese input method.
When we write the file abc.py, when we name the file, we only use these characters in English (a-zA-Z0-9 characters -) to name the file.
Do not use Chinese for naming files, do not use special symbols, and do not add spaces in the middle.
File names are strictly size sensitive.
After reading the above, have you mastered how to write the first line of python code? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!