Initially self-python notes

Reference blog

https://blog.csdn.net/ShiMengRan107/article/details/70242245  )

https://www.cnblogs.com/way_testlife/category/247553.html

https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431643484137e38b44e5925440ec8b1e4c70f800b4e2000

Simple output print ( 'hello Word')

Editor problem: Use IDLE and write Python Shell python (refer blog: https://blog.csdn.net/shimengran107/article/details/70856242 )

IDLE use:

https://blog.csdn.net/Mrs_Wu/article/details/79265427

Python IDLE entry

http://www.cnblogs.com/dsky/archive/2012/06/04/2535397.html

1 Sometimes we only remember the first few letters of a function, then how do? For example, I want to type at run time using raw_input function from the standard input something, I would have this function name is remembered from the "Edit" menu, select "Show completetions" menu item, IDLE will give some tips.

2

def say_hello(name):

    print("Hello{}".format(name))

    for i in range(3):

        print(name

input Output

Export

>>> print('Hello Word!')

Hello Word!

>>> print('100+200=',100+200)

100+200= 300

问题:SyntaxError: multiple statements found while compiling a single statement

Case this problem occurs:

Copy the edited directly enter the code into IDLE

Solution steps:

The code is written .py file

Load the IDLE, run (run / F5) in .py file

Novice Python ** py SyntaxError:. Invalid syntax unknown syntax error

Syntax version may be incompatible

Clear screen

In the Linux shell, a clear screen operation is clear; in Win cmd, the operation is to clear the screen cls.

In interactive mode using python, if you want to clear the screen, you can import os, to invoke system commands clear or clear the screen cls be achieved by os.system ().

>>> import os

>>> os.system('clear')

But this time the state of the shell is:

0

>>>

The first line will have a 0. This is actually the os.system 0 () returns a value of 0 is successful, i.e., non-zero error code (particularly the os.system () returns the corresponding relationship between the command values ​​may be reference herein).

Published 94 original articles · won praise 34 · views 80000 +

Guess you like

Origin blog.csdn.net/dujuancao11/article/details/104144034