#
## 1
* , UTF-8
* , `#-*-coding:utf-8-*-`
## 2
### 2.1
* 4
### 2.2
80 ( 80 120)
* side-by-side diff
*
*
### 2.3
____ ____
* ****** **** `"..."`
unicode`u""`
* ****** **** `'...'`
dict key
* ****** **** `r"..."`
* *** (docstring)*** **** `"""......"""`
### 2.4
*
*
```python
class A:
def __init__(self):
pass
def hello(self):
pass
def main():
pass
```
*
*
### 2.5
* UTF-8
* `#-*-conding:utf-8-*-`
## 3import
* import
```python
#
import os
import sys
#
import sys,os
#
from subprocess import Popen, PIPE
```
* import __absolute__ import
```python
#
from foo.bar import Bar
#
from ..bar import Bar
```
* importdocstring
* import
```python
import os
import sys
import msgpack
import zmq
import foo
```
*
```python
from myclass import MyClass
```
*
```python
import bar
import foo.bar
bar.Bar()
foo.bar.Bar()
```
## 4
* `[=,-,+=,==,>,in,is not, and]`:
```python
#
i = i + 1
submitted += 1
x = x * 2 - 1
hypot2 = x * x + y * y
c = (a + b) * (a - b)
#
i=i+1
submitted +=1
x = x*2 - 1
hypot2 = x*x + y*y
c = (a+b) * (a-b)
```
* `,`
```python
#
def complex(real, imag):
pass
#
def complex(real,imag):
pass
```
*
```python
#
def complex(real, imag=0.0):
pass
#
def complex(real, imag = 0.0):
pass
```
*
```python
#
spam(ham[1], {eggs: 2})
#
spam( ham[1], { eggs : 2 } )
```
*
```python
#
dict['key'] = list[index]
#
dict ['key'] = list [index]
```
*
```python
#
x = 1
y = 2
long_variable = 3
#
x = 1
y = 2
long_variable = 3
```
## 5
Python
1)
```python
foo = long_function_name(var_one, var_two,
var_three, var_four)
```
2) 4
```python
def long_function_name(
var_one, var_two, var_three,
var_four):
print(var_one)
```
`\``+` `.`
```python
session.query(MyTable).\
filter_by(id=1).\
one()
print 'Hello, '\
'%s %s!' %\
('Harry', 'Potter')
```
```python
#
do_first()
do_second()
do_third()
#
do_first();do_second();do_third();
```
`if/for/while`
```python
#
if foo == 'blah':
do_blah_thing()
#
if foo == 'blah': do_blash_thing()
```
## 6docstring
docstring
1. docstring def
2. docstring """ docstring
```python
"""Return a foobar
Optional plotz says to frobnicate the bizbaz first.
"""
"""Oneline docstring"""
```