Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

How to parse list of integers

Đang mở
#624 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Start by running the example.py commands from the issue and trace how Python Fire consumes arguments for the annotated main(this: list[int]) entry point. Check the existing argument-parsing tests and compare the single-value and multi-value cases. Done means one or more integer values are accepted for --this and exposed to main as a list.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

With argparse, you can do:

> python example.py --this 123
> python example.py --this 123 456
> python example.py --this 123 456 789

With Fire, how do you parse a list of integers (including a single element list) like argparse?

# example.py
import fire

def main(this: list[int]):
    print(type(this), this)

if __name__ == '__main__':
    fire.Fire(main)
> python example.py --this 123
<class 'int'> 123

> python example.py --this 123 456
ERROR: Could not consume arg: 456

> python example.py --this 123 456 789
ERROR: Could not consume arg: 456
Ngôn ngữ chính
Python
Star
28.2k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của google/python-fire

Tất cả issue của google/python-fire

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.