In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
I believe many inexperienced people don't know what to do about how to use source files in Python dictionaries. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Python dictionary has become a widely used computer language, but many people still don't know much about the application scheme of Python dictionary. The following article is an introduction to the specific application methods of using source files in Python dictionary. I hope you will get something.
Use source files
Now let's start programming again. When you learn a new programming language, it has become a tradition that the programs you write and run are usually "Hello World" programs. When you run the "Hello World" program, all it does is say "Hello World". As Simon Cozens, who proposed the "Hello World" program, said: "it is the traditional mantra of the god of programming and can help you learn the language better."
Start the editor of your choice, enter the following program, and save it as helloworld.py. Use source files
#! / usr/bin/python # Filename: helloworld.py print 'Hello World'
To run this program, open shell (Linux terminal or DOS prompt) and type the command python helloworld.py. If you use IDLE, use the menu Edit- > Run Script or use the keyboard shortcut Ctrl-F5. The output is shown below. Output
$python helloworld.py Hello World
If you get the same output as shown above, congratulations! You have successfully run your Python program. In case you get an error, make sure the program you typed is correct, and then run the program again. Note that Python is case-sensitive, that is, print is different from Print-- notice that the first is lowercase p and the second is uppercase P. Also, make sure there are no spaces or tabs before the opening character of each line-- we'll discuss why this is important later.
How it works: let's think about the first two lines of the program. They are called comments-anything to the right of the # symbol is a comment. Comments are mainly used as notes for program readers.
The Python should have at least a special form of comment like the * * line. It is called the organization line-the first two characters of the source file are #!, followed by a program. This line tells your Linux/Unix system which interpreter it should run when you execute your program. This will be explained in more detail in the next section. Note that you can always run your program on any platform by specifying an interpreter directly on the command line. It's like ordering python helloworld.py.
Use annotations properly in your program to explain some important details-this will help your program's readers easily understand what the program is doing. Remember, this reader may be you in 6 months!
The comment is followed by a Python statement-- it just prints the text "Hello World". Print is actually an operator, and "Hello World" is called a string-- don't worry, we'll explain these terms in more detail later.
After reading the above, have you mastered how to use the source files in the Python dictionary? 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!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.