DAILY JOURNAL

日々の記録

2,007記事の記録。

2025年10月

  1. 【Python】pop

    リストの要素を削除することのできるpopメソッドについて見ていこう。 サンプルコード pop · ki-hi-ro/python@63f6f86 sample_list = [1, 2, 3, 4, 5] # 何も指定しない場合、最後の要素が削除される popped_element = sample_list.pop() print("Popped element:", popped_element) print("List after popping the last element:", sample_list) # インデックスを指定して要素を削除 popped_element_at_index = sample_list.pop(1)…

    【Python】リスト2つを比較して、もう一方のリストに存在しない要素のリストを作成する

    a_listとb_listがある。 a_listにあって、b_listにない要素のリストを作成する。 ソースコード not_in_others_list.py · ki-hi-ro/python@f07e63c a_list = ['apple', 'banana', 'cherry', 'date'] b_list = ['banana', 'date', 'fig', 'grape'] not_in_b_list = [item for item in a_list if item not in b_list] print("Items in a_list not in b_list:", not_in_b_list) no…

    【Python】indexメソッド

    indexメソッドは、リストやタプルの中で、指定した要素が最初に現れる位置(インデックス)を返すメソッド。 サンプルコード python/index.py at main · ki-hi-ro/python some_list = [1, 2, 3, 4, 5] index = some_list.index(3) print(f"The index of 3 in the list is: {index}") some_tuple = (10, 20, 30, 40, 50) index = some_tuple.index(40) print(f"The index of 40 in the tuple is: {index}") 以下のコ…

  2. 静けさの中に身を置きたい

    今日は金曜日。 現在は、金曜日の夜。 新しく買ったMacBook Airで名古屋の街に繰り出したが、作業スペースの確保ができなかった。 お酒を飲んで早口でまくしたてるように話す連中に意識を持っていかれた。 自分は静けさの中でしか力を発揮できない。 帰りの電車では、がみがみ声のおじさんの近くからそっと離れた。 被害者意識を持ってしまっている。 自分の心の声と自分の呼吸に集中したい。 それができない空間は危険だ。 名古屋より東京の方が自由の風が吹いている。 呼吸ができる。 いや、平日より休日の方がリラックスしている人が多く、呼吸ができるということなのかもしれない。 とにかく、これからは、より自分の心の声と呼吸に集中していこう。 今この瞬間は、もう二度とやっ…

    【git】プルリクエスト

    リモートリポジトリにmasterとmainブランチがある。 master branch is 1 commit ahead of, 2 commits behind main masterブランチがmainよりも1コミット進んでいて、2コミット遅れている。 Contribute > Open pull request これをクリックする。 プルリクエストを記入 mainよりも進んでいる1コミットがmainに統合される。 Create pull requestを押す コンフリクトは起こらなかった。 Mearge pull requestをクリック Confirm mergeをクリック。 マージ完了 Delete branchをクリック mainブランチだ…

    【git】git remote show originをした時のRemote branchesにnew(next fetch will store in remotes/origin)があった

    git remote show originは、リモートリポジトリ(この場合は、origin)の詳細情報を確認するコマンド。 今回のgit remote show originの結果 hiroki@shibatahiroshitakanoMacBook-Air python % git remote show origin * remote origin Fetch URL: https://github.com/ki-hi-ro/python.git Push URL: https://github.com/ki-hi-ro/python.git HEAD branch: main Remote branches: main tracked mast…