0
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

はじめてのPython3で基本を知るためのリンク集

Last updated at Posted at 2019-01-08

データ型

分類
テキストシーケンス型 str '文字'``"文字"``'''文字'''``"""文字"""
シーケンス型 list [1]``[x for x in iterable]``list(1,2,3)
シーケンス型 tuple a, b``(a,b)``tuple([a,b])
# 辞書型を空で初期化
dic = {}
# リスト型を空で初期化
list = []
# 空白文字を一括削除
s = ''.join({空白文字を含む文字列}.split())

# 今日
today = datetime.today()
# 明日
tomorrow = today + timedelta(days=1)
# 来月
next_month = today + relativedelta(months=1)

ライブラリ

MkDocs

pandas

仮想環境を作りたい

# venvで仮想環境を作る
$ python3 -m venv {仮想環境名}

# 仮想環境の有効化(Linux/Mac)
$ source {仮想環境名}/bin/activate
# 仮想環境の有効化(Windows)
$ source {仮想環境名}/Scripts/activate

# 仮想環境を抜ける
(仮想環境名) $ deactivate

演算子

比較演算子

Javaとか Python
x && y x and y
x || y x or y
!x not x

算術演算子

意味 書き方
掛け算 a * b
割り算 a / b
割り算の余り a % b
乗算 a ** b
切捨て割り算 a // b

コーディング規約

コメントを書きたい

# 1行のコメント
'''
複数行コメント
'''

docstring

JsDoc, JavaDoc, PHPDoc的なもので、書き方はNumPy(数値計算を効率的に行うための拡張モジュール)とGoogleスタイルがあるらしい。

def function_name():
    """ドキュメンテーション文字列
    文字列が 1 行内に収まっていても、三連二重引用符を使います。 
    前にも後ろにも空行を入れてはなりません。
    文章は、ピリオドで終えます。
    """

公式サイト・ドキュメント

IDE

PyCharm

やりたいこと Eclipse PyCharm
名前変更(リファクタ) Shft + Alt + R Ctrl + F6
行の削除 Ctrl + D Ctrl + Y
大文字小文字切替 - Ctrl + Shift + U
ステップイン F5 F7
ステップオーバー F6 F8
プログラム再開 F8 F9
式の評価 - Alt + F8
式のクイック評価 - Ctrl + Alt + F8
Windows10でCtrl+Alt+F8を
押下してディスプレイが
表示されなくなった

with Backlog

with AWS Lambda

with Slack

困った

0
9
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?