Skip to content

Instantly share code, notes, and snippets.

@r2k0
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save r2k0/40a3c311866f27e4b740 to your computer and use it in GitHub Desktop.

Select an option

Save r2k0/40a3c311866f27e4b740 to your computer and use it in GitHub Desktop.

Revisions

  1. r2k0 revised this gist Sep 15, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Python-tricks
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,10 @@

    #Serve current directory tree at http://$HOSTNAME:8000/
    python -m SimpleHTTPServer

    #swap
    b, a = a, b

    #
    a = [1,2,3,4,5]
    a[::2] # iterate over the whole list in 2-increments [1,3,5]
    a[::-1] # reversed [5,4,3,2,1]
  2. r2k0 revised this gist Sep 15, 2014. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions Python-tricks
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,7 @@
    '''python

    #Serve current directory tree at http://$HOSTNAME:8000/
    python -m SimpleHTTPServer

    #swap
    b, a = a, b

    '''

  3. r2k0 revised this gist Sep 15, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Python-tricks
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    '''python
    #Serve current directory tree at http://$HOSTNAME:8000/
    python -m SimpleHTTPServer

    #swap
    b, a = a, b

    '''

  4. r2k0 revised this gist Sep 15, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Python-tricks
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    #Serve current directory tree at http://$HOSTNAME:8000/
    python -m SimpleHTTPServer

    #swap
    b, a = a, b

  5. r2k0 created this gist Sep 15, 2014.
    3 changes: 3 additions & 0 deletions Python-tricks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #Serve current directory tree at http://$HOSTNAME:8000/
    python -m SimpleHTTPServer