In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use Python interaction mode". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "how to use Python interaction mode".
By default, the Python source file is UTF-8 encoded.
You can also specify different character encodings for the source file. To this end, in #! Insert at least one special comment line after the line (first line) to define the encoding of the source file.
For example, if your editor does not support UTF-8-encoded files, but supports other encodings like Windows-1252, you can define:
#-*-coding: cp-1252-*-
With this declaration, everything in the source file is treated as if it were cp-1252 encoded. This allows you to use all the characters in the Windows-1252 character set in the source file.
This particular encoding comment must be defined on the first or second line of the file. Second, IDLE interaction mode
The IDLE that comes with python is an interactive interpreter. In this mode, it executes according to the main prompt, which is usually identified as three greater than signs (>).
The continuing part is called the dependent prompt and is identified by three dots (.). Before the first line, the interpreter prints the welcome message, version number, and authorization prompt:
$python3.5
Python 3.5.2 (default, Mar 16 2014, 09:25:04)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
> > >
You need a dependent prompt when entering a multiline structure, for example, the following if statement:
> the_world_is_flat = 1
> if the_world_is_flat:
... Print ("Be careful not to fall off!")
...
Be careful not to fall off!
It is important to note that the subordinate prompt encountered in the exercise indicates that you need to enter one more blank line at the end of the exercise before the interpreter knows that this is the end of a multiline command. III. Notes
Comments in Python start with the # character until the end of the actual line (physical line represents the actual line break rather than the editor's automatic line wrap).
Comments can start at the beginning of the line, or after white space or code, but do not appear in the string.
The # character in the text string represents only #. Comments in the code are not interpreted by Python and can be ignored when entering examples.
The following is an example:
# this is the first comment
Spam = 1 # and this is the second comment
#... And now a third!
Text = "# This is not a comment because it's inside quotes."
Thank you for your reading, the above is the content of "how to use Python interaction mode". After the study of this article, I believe you have a deeper understanding of how to use Python interaction mode, 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.
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.