str.startswith

str.startswith(...)

Description

Documentation for str.startswith.

Python Python String Methods Official Docs

Real-World Examples

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

project_id: str = Path(example="Nest"),
) -> ProjectDetail | ProjectError:
    """Get project."""
    if project := ProjectModel.active_projects.filter(
        key__iexact=(
            project_id if project_id.startswith("www-project-") else f"www-project-{project_id}"
        )
    ).first():
        return project

    return Response({"message": "Project not found"}, status=HTTPStatus.NOT_FOUND)
source_file = ""
    lines_infos = {}
    file_hash_lookup = {}
    for i, line in enumerate(lines):
        lines_dict = {}
        if line.startswith("**"):
            func_name = line.replace("**", "").replace(" ", "").strip()
            rva_seg_length = 0
            dbg_seg_length = 0
            func_name_infoitem = {}
        if line.startswith("line"):
            if len(re.split(r"\w:\\", line)) == 2:
                source_file = re.findall(r"\w:\\", line)[0] + re.split(r"\w:\\", line)[1]
                if "MD5" in source_file:
                    source_file_cleaned = source_file.split(" (MD5: ")[0]
                    source_file_md5 = source_file.split(" (MD5: ")[1].replace(")", "")
                    file_hash_lookup[source_file_cleaned.strip()]=source_file_md5
                if "0x3" in source_file:
                    source_file_cleaned = source_file.split(" (0x3: ")[0]
                    source_file_md5 = source_file.split(" (0x3: ")[1].replace(")", "")
                    file_hash_lookup[source_file_cleaned.strip()]=source_file_md5
            rva = re.findall(r"at \[\w+\]", line)[0].replace("at ", "").replace("[", "").replace("]", "")
            length = int(re.findall(r"len \= \w+", line)[0].replace("len = ", ""), 16)
            line_number = int(re.findall(r"line \d+", line)[0].replace("line ", ""))
            lines_dict["line_number"] = line_number