<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/taketake4132/">
    <title>taketake4132 @ ウィキ</title>
    <link>http://w.atwiki.jp/taketake4132/</link>
    <atom:link href="https://w.atwiki.jp/taketake4132/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>taketake4132 @ ウィキ</description>

    <dc:language>ja</dc:language>
    <dc:date>2013-03-25T21:11:44+09:00</dc:date>
    <utime>1364213504</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/19.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/18.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/17.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/16.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/2.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/7.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/8.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/9.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/taketake4132/pages/10.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/19.html">
    <title>リスト</title>
    <link>https://w.atwiki.jp/taketake4132/pages/19.html</link>
    <description>
      [[タプル]]との違いは初期化後に変更可能であること

*リストの基本

#highlight(linenumber, python){
test_list1=[&#039;pyhon&#039;, &#039;-&#039;,&#039;izm&#039;, &#039;.&#039;, &#039;com&#039;]
print test_list1

for i in test_list_1:
    print i
}

実行結果
[&#039;[[python]]&#039;, &#039;-&#039;, &#039;izm&#039;, &#039;.&#039;, &#039;com&#039;]
python
&amp;nowiki(){-}
izm
.
com

タプルは()を使って初期化していたが
リストは[]を使う。

*値の追加
append関数を使ってリストの末尾に指定の値を追加可能。

#highlight(linenumber, python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 


test_list_1 = []
print test_list_1

print &#039;--------------------------------&#039;

test_list_1.append(&#039;python&#039;)
test_list_1.append(&#039;-&#039;)
test_list_1.append(&#039;izm&#039;)
test_list_1.append(&#039;.&#039;)
test_list_1.append(&#039;com&#039;)

print test_list_1
}

実行結果
[]
&amp;nowiki(){--------------------------------}
[&#039;python&#039;, &#039;-&#039;, &#039;izm&#039;, &#039;.&#039;, &#039;com&#039;]

*インデックスを指定して追加
appendは常に末尾に追加される。
insertを使うと指定したインデックスに追加することが可能。

#highlight(linenumber,python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 


test_list_1 = [&#039;python&#039;,&#039;izm&#039;,&#039;com&#039;]
print test_list_1

print &#039;--------------------------------&#039;

test_list_1.insert(1,&#039;-&#039;)
test_list_1.insert(3,&#039;.&#039;)

print test_list_1

test_list_1.insert(0,&#039;&lt;a href=&quot;http://www.&quot; target=&quot;_blank&quot; rel=&quot;noreferrer&quot; style=&quot;cursor:help;display:inline !important;&quot;&gt;http://www.&lt;/a&gt;&#039;)

print test_list_1
}

実行結果
[&#039;python&#039;, &#039;izm&#039;, &#039;com&#039;]
&amp;nowiki(){--------------------------------}
[&#039;python&#039;, &#039;-&#039;, &#039;izm&#039;, &#039;.&#039;, &#039;com&#039;]
[&#039;http://www.&#039;, &#039;python&#039;, &#039;-&#039;, &#039;izm&#039;, &#039;.&#039;, &#039;com&#039;]

*値の削除
remove関数を使用すると指定の引数の値を削除する。
ただし、最初に見つかった値だけを削除するので
複数個ある場合は最初だけ。
#highlight(linenumber,python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 


test_list_1 = [&#039;1&#039;,&#039;2&#039;,&#039;3&#039;,&#039;2&#039;,&#039;1&#039;]
print test_list_1

print &#039;--------------------------------&#039;

test_list_1.remove(&#039;2&#039;)

print test_list_1
}

実行結果
[&#039;1&#039;, &#039;2&#039;, &#039;3&#039;, &#039;2&#039;, &#039;1&#039;]
&amp;nowiki(){--------------------------------}
[&#039;1&#039;, &#039;3&#039;, &#039;2&#039;, &#039;1&#039;]

*値の削除2
pop関数は指定のインデックス値が存在する値を削除する。
削除された値を返り値として返す。
引数なしだと末尾の値が削除される。
#highlight(linenumber, python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 


test_list_1 = [&#039;1&#039;,&#039;2&#039;,&#039;3&#039;,&#039;2&#039;,&#039;1&#039;]
print test_list_1

print &#039;--------------------------------&#039;

print test_list_1.pop(1)
print test_list_1

print test_list_1.pop()
print test_list_1
}

実行結果
[&#039;1&#039;, &#039;2&#039;, &#039;3&#039;, &#039;2&#039;, &#039;1&#039;]
2
[&#039;1&#039;, &#039;3&#039;, &#039;2&#039;, &#039;1&#039;]
1
[&#039;1&#039;, &#039;3&#039;, &#039;2&#039;]

最初のpop関数は2を削除し、次のpopが1を削除する。

*要素のインデックスを取得する。
index関数を利用すると、指定の引数に該当するインデックス値の取得が可能
removeと同様に最初に見つかった値のインデックスのみを返す。
#highlight(linenumber,python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 


test_list_1 = [&#039;100&#039;,&#039;200&#039;,&#039;300&#039;,&#039;200&#039;,&#039;100&#039;]

print test_list_1.index(&#039;200&#039;)
}

実行結果
1

最初に見つかった200のインデックス値が返される。

*リスト内での要素数を取得
count関数は指定の引数値がリスト内で何回出現するか返す。
#highlight(linenumber,python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 


test_list_1 = [&#039;100&#039;,&#039;200&#039;,&#039;300&#039;,&#039;200&#039;,&#039;100&#039;]

print test_list_1.count(&#039;200&#039;)

print &#039;--------------------------------&#039;

for i in range(test_list_1.count(&#039;200&#039;)):
    test_list_1.remove(&#039;200&#039;)

print test_list_1
}

実行結果
2
[&#039;100&#039;, &#039;300&#039;, &#039;100&#039;]

countとremoveを合わせると指定の要素をすべて削除することも可能。    </description>
    <dc:date>2013-03-25T21:11:44+09:00</dc:date>
    <utime>1364213504</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/18.html">
    <title>タプル</title>
    <link>https://w.atwiki.jp/taketake4132/pages/18.html</link>
    <description>
      タプルとは？
複数の要素から成り、それを一つの値として扱える機能。
[[リスト]]と違い、初期化後に内包する値の変更ができない。
&amp;u(){タプルの場合は初期化後の変更は&amp;bold(){「不可」}、リストの場合は&amp;bold(){「可」}となる。}

#highlight(linenumber, python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 

import datetime

def getToday():

    today = datetime.datetime.today()
    value = (today.year,today.month,today.day)

    return value

if __name__ == &quot;__main__&quot;:

    test_tuple = getToday()

    print test_tuple
    print test_tuple[0]
    print test_tuple[1]
    print test_tuple[2]
}

実行結果
(2010, 5, 8)
2010
5
8


ここで注目するのは9行目
ここでタプルを初期化しており、この値を変更しようとするとエラーになる。    </description>
    <dc:date>2013-03-25T20:21:45+09:00</dc:date>
    <utime>1364210505</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/17.html">
    <title>日付</title>
    <link>https://w.atwiki.jp/taketake4132/pages/17.html</link>
    <description>
      日付の取得方法は下記のように
「datetime」モジュールを使用する。
#highlight(linenumber,python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 

import datetime

if __name__ == &quot;__main__&quot;:

    today        =    datetime.date.today()
    todaydetail  =    datetime.datetime.today()
    
    #    今日の日付
    print &quot;--------------------------------------------&quot;
    print today
    print todaydetail
    
    #    今日に日付：それぞれの要素値
    print &quot;--------------------------------------------&quot;
    print today.year
    print today.month
    print today.day
    print todaydetail.year
    print todaydetail.month
    print todaydetail.day
    print todaydetail.hour
    print todaydetail.minute
    print todaydetail.second
    print todaydetail.microsecond
    
    #    日付のフォーマット
    print &quot;--------------------------------------------&quot;
    print today.isoformat()
    print todaydetail.strftime(&quot;%Y/%m/%d %H:%M:%S&quot;)
}


実行結果
--------------------------------------------
2010-05-08
2010-05-08 15:42:00.731000
--------------------------------------------
2010
5
8
2010
5
8
15
42
0
731000
--------------------------------------------
2010-05-08
2010/05/08 15:42:00



日付の計算は「timedelta」を使用する。
「timedelta」では月の日数、うるう年なども気にする必要がない。
#highlight(linenumber,python){
#! c:/Python26/python.exe
# -*- coding: utf-8 -*- 

import datetime

if __name__ == &quot;__main__&quot;:

    today    =    datetime.datetime.today()
    
    #    今日の日付
    print today
    
    #    明日の日付
    print today + datetime.timedelta(days=1)

    newyear    =    datetime.datetime(2010,1,1)
    
    #    2010年1月1日の一週間後
    print newyear + datetime.timedelta(days=7)

    #    2010年1月1日から今日までの日数
    calc    =    today - newyear
    #    計算結果の返り値は「timedelta」
    print calc.days
}

実行結果
2010-05-08 15:36:24.006000
2010-05-09 15:36:24.006000
2010-01-08 00:00:00
127    </description>
    <dc:date>2013-03-24T16:59:01+09:00</dc:date>
    <utime>1364111941</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/15.html">
    <title>python</title>
    <link>https://w.atwiki.jp/taketake4132/pages/15.html</link>
    <description>
      pythonについて調べたことなどを残していく。



「__name__」とは？「__main__」とは？
pythonのコードで以下のように書いてあるものについて
if __name__ == &quot;__main__&quot;:

これはC言語でいうmain関数のようなもの。
スクリプトを起動した際に変数「__name__」には「__main__」という値が入る。


&amp;bold(){[[文字列]]}    </description>
    <dc:date>2013-03-24T16:42:08+09:00</dc:date>
    <utime>1364110928</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/16.html">
    <title>文字列</title>
    <link>https://w.atwiki.jp/taketake4132/pages/16.html</link>
    <description>
      **文字列の基礎
[[python]]の文字列は「&#039;」(シングルクォーテーション)と
「&quot;」(ダブルクォーテーション)の両方で表現される。

**文字列の連結
文字列の連結は+を使う。
test_str = &quot;012&quot;
test_str += &quot;345&quot;

実行結果　012345

**文字列への変換
文字列への変換(キャスト)は下記の通り。
test_str = 100
print str(test_str) + &quot;円&quot;

実行結果
100円

**文字列の置換
文字列の置換は「replace」を使う。
test_str=&quot;python-izm&quot;
print test_str.replace(&quot;izm&quot;, &quot;ism&quot;)

実行結果
python-ism

**文字列の分割
文字列の分割はsplit関数を使用する。
この関数は[[タプル]]形式で返り値を返す。
test_str=&quot;python-izm&quot;
print test_str.split(&quot;-&quot;)

実行結果
[&#039;python&#039;, &#039;izm&#039;]

**文字列のゼロ埋め
文字列の左にゼロを埋める場合はrjustを使い込む
第一引数が埋めた後の桁数、第二引数が埋め込む文字列です。
当然ゼロ以外の文字列も埋め込むことが可能となる。
もしくはゼロ限定で「zfill」が使える。
test_str=&quot;1234&quot;
print test_str.rjust(10,&quot;0&quot;)
print test_str.rjust(10,&quot;!&quot;)
print test_str.zfill(10)
print test_str.zfill(3)

実行結果
0000001234
!!!!!!1234
0000001234
1234

**文字列の検索
任意の文字列のが先頭にあるか調べる方法。
文字列に任意の文字が含まれているか調べる方法
test_str=&quot;python-izm&quot;
print test_str.startswith(&quot;python&quot;)
print test_str.startswith(&quot;izm&quot;)
print &quot;z&quot; in test_str
print &quot;s&quot; in test_str

実行結果
True
False
True
False


**大文字、小文字変換
指定の文字列を大文字、小文字へ変換するには「upper」もしくは「lower」関数を使う。
test_str=&quot;Python-Izm.Com&quot;
print test_str.upper()
print test_str.lower()

実行結果
PYTHON-IZM.COM
python-izm.com

**先頭・末尾の削除
文字列の先頭・末尾を削除した値を取得する。
それぞれ「lstrip」は先頭から、「rstrip」は末尾から削除する
引数なしでは空白を除去する。

#highlight(linenumber,python){{
#! c:/Python26/python.exe
# -*- coding: utf-8 -*-

print &quot;----------------------------------&quot;

test_str = &quot;     python-izm.com&quot;
print test_str

test_str = test_str.lstrip()   #先頭の空白を削除
print test_str
    
test_str = test_str.lstrip(&quot;python&quot;) #先頭のpythonまでを削除
print test_str

print &quot;----------------------------------&quot;

test_str = &quot;python-izm.com     &quot;
print test_str + &quot;/&quot;

test_str = test_str.rstrip() 
print test_str + &quot;/&quot;
    
test_str = test_str.rstrip(&quot;com&quot;)
print test_str
}}

実行結果
================================
&amp;space(4)python-izm.com
python-izm.com
&amp;nowiki(){-izm.com}
================================
python-izm.com   /
python-izm.com/
python-izm.    </description>
    <dc:date>2013-03-24T16:20:01+09:00</dc:date>
    <utime>1364109601</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/2.html">
    <title>メニュー</title>
    <link>https://w.atwiki.jp/taketake4132/pages/2.html</link>
    <description>
      **メニュー
-[[トップページ]]
-[[プラグイン紹介&gt;プラグイン]]
-[[まとめサイト作成支援ツール]]
-[[メニュー]]
-[[メニュー2]]

----
**プログラミング
-[[python]]

**リンク
-[[@wiki&gt;&gt;http://atwiki.jp]]
-[[@wikiご利用ガイド&gt;&gt;http://atwiki.jp/guide/]]

**他のサービス
-[[無料ホームページ作成&gt;&gt;http://atpages.jp]]
-[[無料ブログ作成&gt;&gt;http://atword.jp]]
-[[2ch型掲示板レンタル&gt;&gt;http://atchs.jp]]
-[[無料掲示板レンタル&gt;&gt;http://atbbs.jp]]
-[[お絵かきレンタル&gt;&gt;http://atpaint.jp/]]
-[[無料ソーシャルプロフ&gt;&gt;http://sns.atfb.jp/]]

// リンクを張るには &quot;[&quot; 2つで文字列を括ります。
// &quot;&gt;&quot; の左側に文字、右側にURLを記述するとリンクになります


//**更新履歴
//#recent(20)

&amp;link_editmenu(text=ここを編集)    </description>
    <dc:date>2013-03-24T14:48:13+09:00</dc:date>
    <utime>1364104093</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/7.html">
    <title>プラグイン/アーカイブ</title>
    <link>https://w.atwiki.jp/taketake4132/pages/7.html</link>
    <description>
      * アーカイブ
@wikiのwikiモードでは
 #archive_log()
と入力することで、特定のウェブページを保存しておくことができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/25_171_ja.html


-----


たとえば、#archive_log()と入力すると以下のように表示されます。
保存したいURLとサイト名を入力して&quot;アーカイブログ&quot;をクリックしてみよう


#archive_log()
    </description>
    <dc:date>2013-03-24T14:37:35+09:00</dc:date>
    <utime>1364103455</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/8.html">
    <title>プラグイン/RSS</title>
    <link>https://w.atwiki.jp/taketake4132/pages/8.html</link>
    <description>
      *RSSを取り込んで一覧表示(showrss)
 #showrss(ここにＲＳＳのＵＲＬ)
もしくは
 #rss(ここにＲＳＳのＵＲＬを入力)
と入力することで指定したＲＳＳを取り込んで一覧表示します。

詳しくはこちらをご覧ください。
＝＞http://www1.atwiki.jp/guide/pages/266.html#id_b6d0b10d

----
たとえば、#showrss(http://iphone.appinfo.jp/rss/pricedown/,target=blank,countrss,lasttime) と入力すると以下のように表示されます。

#showrss(http://iphone.appinfo.jp/rss/pricedown/,target=blank,countrss,lasttime)
    </description>
    <dc:date>2013-03-24T14:37:35+09:00</dc:date>
    <utime>1364103455</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/9.html">
    <title>プラグイン/動画(Youtube)</title>
    <link>https://w.atwiki.jp/taketake4132/pages/9.html</link>
    <description>
      * 動画(youtube)
@wikiのwikiモードでは
 #video(動画のURL)
と入力することで、動画を貼り付けることが出来ます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_209_ja.html

また動画のURLはYoutubeのURLをご利用ください。
＝＞http://www.youtube.com/

-----


たとえば、#video(http://youtube.com/watch?v=kTV1CcS53JQ)と入力すると以下のように表示されます。


#video(http://youtube.com/watch?v=kTV1CcS53JQ)

    </description>
    <dc:date>2013-03-24T14:37:35+09:00</dc:date>
    <utime>1364103455</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/taketake4132/pages/10.html">
    <title>プラグイン</title>
    <link>https://w.atwiki.jp/taketake4132/pages/10.html</link>
    <description>
      @wikiにはいくつかの便利なプラグインがあります。

-----


#ls

-----

これ以外のプラグインについては@wikiガイドをご覧ください
=&gt;http://atwiki.jp/guide/
    </description>
    <dc:date>2013-03-24T14:37:35+09:00</dc:date>
    <utime>1364103455</utime>
  </item>
  </rdf:RDF>
