2019-01-19から1日間の記事一覧
対話モード時最後に表示した式を格納している変数 _ アンダースコア バイナリデータレコードの処理を行うモジュールstruct import json x = {'name':'shinriyo','data':[2,3,4]} print(json.dumps(x)) 結果 {"name": "shinriyo", "data": [2, 3, 4]} "になっ…
class Sample: c_list = [] def add_c_list(self,data): self.c_list.append(data) print("result:", end=" ") sample1 = Sample() sample1.add_c_list("data1") sample2 = Sample() sample2.add_c_list("data2") for item_data in sample2.c_list: print(it…
資格のために勉強 3章 docs.python.jp 除算 (/) は常に浮動小数点数を返します。 > print('Py' 'thon') Python 連結される。 >>> word[4:42] 'on' >>> word[42:] '' 4章 docs.python.jp >>> for n in range(2, 10): ... for x in range(2, n): ... if n % x …