Let it be

Saturday, January 20, 2024

 

Python Collections (Arrays)


List:  list =["mango", "strawberry", "orange","apple", "banana"]
 

Array a = arr.array('i', [1, 2, 3])

tuple = ("orange","apple","banana")

set : thisset = {"apple", "orange", "banana"}

dictionary : thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964  }


Python Collections (Arrays)

There are four collection data types in the Python programming language:

  • List is a collection which is ordered and changeable. Allows duplicate members.
  • Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
  • Set is a collection which is unordered, unchangeable*, and unindexed. No duplicate members.
  • Dictionary is a collection which is ordered** and changeable. No duplicate members.


Friday, January 12, 2024

Run cron schedule job on Github Actions



1. Create a project at Github

2. Create your all python programs at this project, or import your python programs

3. Creaet a new .github folder(P.S. there's a "." period prefix )

4. At .github folder, create a yaml file

5. After press "Commit Change", the cron job will run on your schedule.

(P.S. the time is based on UTC time zone)


yaml sample file

name: Github crontab action demo

on:

  schedule:

    - cron: '0 6,21 * * *'

jobs: 

  Explorer-Github-Actions:

    runs-on: ubuntu-latest

    steps:

      - name: Checkout

        uses: actions/checkout@v4

      - name: Setup Python Version

        uses: actions/setup-python@v2

        with:

          python-version: 3.11 # Install the python version needed


      - name: Install Python dependencies

        run: pip install -r requirements.txt

      - name: get stock price

        run:

          python3 dyudaily.py

      - name: List files on the folder 002

        run:

          ls ${{ github.workspace }}