The first chapter a basic python
Why are not repeated here to learn python as a programming, online search a basketful. I only say this python is good, you will fall in love with it.
This python example code with your 1000+ progressive approach to understand the basics of python, basic grammar, basic programming skills, scripting to write the project.
All book sample code runs successfully in Ubuntu16.04 + Python 3.5.2 + pycharm.
Example 1: Hello World program
1, the preparation of the program in the interpreter
2, create a file in linux called hello.py (tell people this is written in python code), and enter the print, and perform ( "Hello World!"):
If you need to execute a shell script like python script execution as "./hello.py", you need to specify the interpreter in the head hello.py file
#!/usr/bin/env python:
As a result, execution: ./hello.py can be. ps: hello.py to be given permission to perform before the execution, chmod + x (or 755) hello.py
3, the use of development tools pycharm to write hello.py (high pycharm development efficiency, auto-complete, debugging, etc.)
Pycharm New Project steps:
1) Create a new project: File-New project - location (path selection) - create;
Such as: / Test_code / python with reference to exemplary learning / Source
2) Create a new directory: Project Name Right --NEW - Directory;
Such as: / Test_code / python with reference to exemplary learning / source / python base
3) Create a Python file: the name of the directory right --python file-- type python file name (try to write on behalf of a sense of English);
Such as: / Test_code / python with reference to exemplary learning / source / python basis /var.py
4) Create a pycharm common template: File - settings - Editor - code Style - Python Script-- Input File and Code on the right side of Templates-- the following custom content, the following appears every time when new Python File
'''
#!/usr/bin/env python
Author:Ranxf
'''
Such as: