str.split
str.split(...)Description
Documentation for str.split.
Real-World Examples
Practical code examples showing how str.split is used in real projects.
# 提取子主题
sub_topics = []
sub_topics_text = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], "sub_topics")
if sub_topics_text:
sub_topics = [topic.strip() for topic in sub_topics_text.split(",")]
# 提取语言
language = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], "language")
# 提取最低星标数
min_stars = 0
min_stars_text = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], "min_stars")
if min_stars_text and min_stars_text.isdigit():
min_stars = int(min_stars_text)
# 解析GitHub搜索参数 - 英文
english_github_query = self._extract_tag(extracted_responses[self.GITHUB_QUERY_INDEX], "query")
# 解析GitHub搜索参数 - 中文
chinese_github_query = self._extract_tag(extracted_responses[2], "query")
# 构建GitHub参数
github_params = {
"query": english_github_query,
specialized_query += f" language:{' language:'.join(languages)}"
# Extract keywords
keywords = [
word
for word in query.split()
if len(word) > 3
and word.lower()
not in [
"recommend",
"recommended",
"github",
"repositories",
"looking",
"developers",
"contribute",
"contributing",
"beginner",
"newcomer",
]
]
if keywords:
specialized_query += " " + " ".join(
keywords[:5]