python variables and data types
One, integer
int = 20print Intprint 45678 + 0x12fd2
Second, floating point number
float = 2.3print float
Three, string
A, use single quotation marks (') to enclose the string in single quotation marks, for example: str = ' This is string ' Print strb, use double quotation marks (") in double quotation marks and string usages in si
Input1 format:Input ([prompt]) prompt for cue information ctrl + Z end input2 function functions:Accepts a standard input data, returns a string type3 Examples: Print1 format: print ([object, ...], *, sep= ', end= ' \ n ', file=sys.stdout) (end default value is carriage return, customizable symbol)2 function functions:Output various types of data: String, Integer, floating-point, perceive, and precision control3 Examples:
statement, which is the variable. That is, in many cases, the parameters and variables in the function are not so distinguished, as long as you know the object is through what channel, that thing to what the target can be.
To make it more obvious that the args (name can be different, but the symbol must have), you can use one of the following simple functions to demonstrate:
Copy Code code as follows:
>>> def foo (*args):
..
Product Manager learn Python: Understand variables and strings, product manager python
A few months ago, I began to learn about personal image management, from hair styles, makeup, costumes to instruments and manners. I started to make new changes to my personal style, the most basic thing is to first understand which style you belong to, and then find the refere
output as follows:Yiwangzhibujianhello YiwangzhibujianNote: input receives a string, even if the input is 1, if a number is required to be converted.2.3 Int ()/float ()These two methods also use more, that is, the conversion of strings to integer or floating-point method.Num=int ('ten')print(num+1)The addition of strings and numbers will result in an error, so conversion is required.2.4 isinstance ()This method is more used when defining a method, be
when the function call finishes returning the keynote function.Actual parameters:Can be constants, variables, expressions, functions, and so on, regardless of the actual argument is the type of amount, in the function call, they must have a certain value, in order to pass these values to the parameter, so the parameters should be pre-assigned, input and so on to get the value of the argument.Such as:Def calc (x, y): #x和y is the formal parameterres =
Town Field Poem:——— Dream who feel, the water month Build blog. Baiqian tribulation, only know the vicissitudes of the world.——— today holds the Buddhist language, the technology is boundless willing to learn. Willing to do what you learn, cast a conscience blog.——————————————————————————————————————————1 Code1 x,y,z=4,5,5.123print(x)4print(y)5 print(z)2 Show——————————————————————————————————————————The essence of the blog, in the technical part, mor
English documents:print(*objects, sep= ', end= ' \ n ', file=sys.stdout, flush=false)Print Objects to the text stream file, separated by Sep and followed by end. Sep, end and file, if present, must be given as keyword arguments. All Non-keyword arguments is converted to strings like str () Does and written to the stream, separated by Sep and followed by end . Both Sep and end must be strings; They can also is none , which means to use the defa
6. Local variables and global variablesA variable defined in a subroutine is called a local variable, and a variable defined at the beginning of the program is called a global variable.The global variable scope is the entire program, and the local variable scope is the subroutine that defines the variable. When a global variable has the same name as a local variable: Local variables work within subroutin
First, the variable typeThe value that the variable is stored in memory. This means that there is a space in memory when creating variables.Based on the data type of the variable, the interpreter allocates the specified memory and determines what data can be stored in memory.Therefore, variables can specify different data types, which can store integers, decimals, or characters.Assigning values to variablesVariable assignments in
messageslogging.basicConfig(format=‘%(asctime)s - %(levelname)s - %(message)s‘)logging.warning(‘This message will appear in python console.‘)Print the following output directly in the Python console:2016-8-2 2:59:11, 510 - WARNING - This message will appear in python consoleLogging Advanced usageThe logging function c
Linux installation: Compiling and installing the installation package downloadPython installation package:Python-3.5.5.tgzTar zxvf python-3.6.4.tgz CD Python-3.6.4Specifying the installation directory./configure--prefix=/home/sshuser/python3.6 Make do installCheck version/home/dxl/python3.5/bin/python3.6–vInstall the three-party libraryCd/home/dxl/python3.6/lib mkdir site-packages CD site-packages/Third-par
characters, such as a \n newline, a \t tab, and the character itself, \ so \\ the character that is represented is \ You can use the print string in Python's interactive command line to see:print‘I\‘m ok.‘I‘m ok.>>> print ‘I\‘m learning\nPython.‘I‘m learningPython.>>> print ‘\\\n\\‘If there are a lot of characters in the string that need to be escaped, you need
characters, such as a \n newline, a \t tab, and the character itself, \ so \\ the character that is represented is \ You can use the print string in Python's interactive command line to see:' i\ ' m OK. ' I ' m OK. ' i\ ' m learning\npython. ' I ' M Learning Python. ' \\\n\\ 'If there are a lot of characters in the string that need to be escaped, you need to add a lot \ , in order to simplify,
Learn wxPython in action and Demo programs and take some study notes.
WxPython prints by using device context and drawing operations. An important class for printing in wxPython: wx. PrintOut, which manages the actual image part. The Print Output instance can be managed by a wx. Printer object that represents the Printer or the wx. PrintPreview object that is used to print the preview. Next I will introduce
"OK"!The escape character \ can escape a number of characters, such as a \n newline, a \t tab, and the character itself, \ so \\ the character that is represented is \ that you can look at the interactive command line in Python with a print() printed string:print(‘I\‘m ok.‘)I‘m ok.>>> print(‘I\‘m learning\nPython.‘)I‘m learningPython.>>>
\ n means line break, \ t for tab, character \ itself to escape, so the character is \, can be used in the Python interactive command line print a string to see:
>>> print ' i\ ' m ok. '
I ' m OK.
>>> print ' I\ ' m learning\npython. '
I ' m learning
Python.
>>>
Python built-in functions (50) -- print, pythonprint
English document:
print(* Objects,Sep ='',End = '\ N',File = sys. stdout,Flush = False)
PrintObjectsTo the text streamFile, SeparatedSepAnd followedEnd.Sep,EndAndFile, If present, must be given as keyword arguments.
All non-keyword arguments are converted to strings likestr()Does and written to the stream, sepa
will produce the following results:
1001000.0John
Multiple assignments:
Python allows you to specify a value for several variables at the same time. For example:
A = b = c = 1
Here, the integer object creates a value of 1, and all three variables are assigned to the same memory location. You can also separate
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.