str.count

str.count(...)

Description

Documentation for str.count.

Python Python String Methods Official Docs

Real-World Examples

Practical code examples showing how str.count is used in real projects.

if repos and "items" in repos:
            for i, repo in enumerate(repos["items"], 1):
                print(f"\n--- 仓库 {i} ---")
                print(f"名称: {repo['full_name']}")
                print(f"描述: {repo['description']}")
                print(f"星标数: {repo['stargazers_count']}")
                print(f"Fork数: {repo['forks_count']}")
                print(f"最近更新: {repo['updated_at']}")
                print(f"URL: {repo['html_url']}")

        # 示例2:获取特定仓库的详情
        print("\n=== 示例2:获取特定仓库的详情 ===")
        repo_details = await github.get_repo("microsoft", "vscode")
        if repo_details:
            print(f"名称: {repo_details['full_name']}")
            print(f"描述: {repo_details['description']}")
            print(f"星标数: {repo_details['stargazers_count']}")
            print(f"Fork数: {repo_details['forks_count']}")
            print(f"默认分支: {repo_details['default_branch']}")
            print(f"开源许可: {repo_details.get('license', {}).get('name', '无')}")
            print(f"语言: {repo_details['language']}")
            print(f"Open Issues数: {repo_details['open_issues_count']}")

        # 示例3:获取仓库的提交历史
        print("\n=== 示例3:获取仓库的最近提交 ===")
}
            }
        }
        """
        self.bulk_size = 50
        self.bulk_count = 2
        self.gql_stars = self.gql_format % ("stars:>1000 sort:stars", self.bulk_size, "%s")
        self.gql_forks = self.gql_format % ("forks:>1000 sort:forks", self.bulk_size, "%s")
        self.gql_stars_lang = self.gql_format % ("language:%s stars:>0 sort:stars", self.bulk_size, "%s")

        self.col = ['rank', 'item', 'repo_name', 'stars', 'forks', 'language', 'repo_url', 'username', 'issues',
                    'last_commit', 'description']

    @staticmethod
    def parse_gql_result(result):
        res = []
        for repo in result["data"]["search"]["edges"]:
            repo_data = repo['node']
            res.append({
                'name': repo_data['name'],
                'stargazers_count': repo_data['stargazerCount'],
                'forks_count': repo_data['forkCount'],
                'language': repo_data['primaryLanguage']['name'] if repo_data['primaryLanguage'] is not None else None,
                'html_url': repo_data['url'],
                'owner': {