VMware ESX vCenter Linux windows CCNA 忍者ブログ

IT号 着地号 いろいろ号

 ITに関しての調べ物です。バージョンや出展はつど記事に記載予定です。

カレンダー
05 2025/06 07
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
リンク
カテゴリー
かぶりもの
最新CM
[06/07 gay]
[02/16 gay]
[02/12 ヴィトン セカンドバッグ スーパーコピー ヴィトン]
[09/30 vente boutique canada goose paris]
[09/28 canada goose belgique]
最新記事
プロフィール
HN:
ESXi
性別:
非公開
バーコード
RSS
ブログ内検索
アーカイブ
最古記事
(01/14)
(01/20)
(01/20)
(01/26)
(01/26)
忍者アナライズ

文字列中の文字の参照

[]を使うと文字列の中の任意の文字を取り出せます。[]の中にはゼロ(0)から始まるインデックス番号を指定します。文字列の末尾(右端)から数える場合は、-1から始めます。


拍手[0回]

PR
2018.05.26 (Sat)
Category[Python]
Comment(0)

予約語一覧

and
as
assert
break
class
continue
def
del
elif
else
except
False
finally
for
from
global
if
import
in
is
lambda
nonlocal
None
not
or
pass
True
raise
return
try
while
with
yield

拍手[0回]

2018.05.26 (Sat)
Category[Python]
Comment(0)

オブジェクト指向とは

オブジェクト指向とは、プログラミングの機能をグループ化し、これを組み合わせてプログラムを作成していく考え方です。機能単位の独立性が高まり、再利用性がを高めることができます。

拍手[0回]

2018.05.26 (Sat)
Category[Python]
Comment(0)

Pythonで英単語の出現回数を数える場合

# 単語の出現回数をカウント
text = """
Keep on asking, and it will be given you:
Keep on seeking, you will find;
Keep on knocking, and it will be opend to you;
for everyone asking receives, and everyone seeking finds,
and to everyone knocking, it will be opend.
"""

# 単語を区切る
text = text.replace(";","") # ;を削除
text = text.replace(",","") # ,を削除
text = text.replace(".","") # .を削除
words = text.split() # 空白で区切ってリスト型を作成

# 単語を数える
counter = {} # counterという空の辞書型を作成
for w in words:
ws = w.lower() # 小文字に変換
if ws in counter: # もし辞書型にすでにキーがあれば値を1つ追加
counter[ws] += 1
else:
counter[ws] = 1 # もし辞書型にキーがなければ、値を1としてキーも登録

# 結果を表示。3回以上のものだけを表示
for k,v in sorted(counter.items()): # counterのキーをアルファベット順として範囲に指定
if v >= 3:
print(k, v)

拍手[0回]

2017.04.15 (Sat)
Category[Python]
Comment(0)
Copyright © ESXi All Right Reserved.
Powered by Ninja Blog.
Template-Designed by ガスボンベ.