# -*- coding: utf-8 -*-
import io
P = r"D:/work buddy/2026-11-05-14-15-52/index_main.html"
s = io.open(P, encoding="utf-8").read()
rows = []
def A(college, en, cn, deg, url, disc):
    rows.append(["uw", college, en, cn, deg, url, disc])

W = "https://uwaterloo.ca/future-graduate-students/programs/by-faculty/"
AR = "文学院"
EN = "工程学院"
EV = "环境学院"
HE = "健康学院"
MA = "数学学院"
SC = "理学院"

# ---- 文学院 ----
A(AR,"Accounting","会计学","PhD",W+"arts/accounting-doctor-philosophy-phd","biz")
A(AR,"Anthropology (Public Issues)","人类学（公共议题）","MA",W+"arts/anthropology-public-issues-master-arts-ma","soc")
A(AR,"Catholic Thought","天主教思想","MCT",W+"arts/catholic-thought-master-catholic-thought-mct","art")
A(AR,"Classical Studies","古典学","MA",W+"arts/classical-studies-master-arts-ma","art")
A(AR,"Economics","经济学","MA",W+"arts/economics-master-arts-ma","soc")
A(AR,"Economics (Co-op)","经济学（带薪实习）","MA",W+"arts/economics-co-op-master-arts-ma","soc")
A(AR,"Economics (Applied Economics)","经济学（应用经济学）","PhD",W+"arts/economics-applied-economics-doctor-philosophy-phd","soc")
A(AR,"English (Critical Media Studies)","英语（批判媒体研究）","MA",W+"arts/english-critical-media-studies-master-arts-ma","art")
A(AR,"English (Literary Studies)","英语（文学研究）","MA",W+"arts/english-literary-studies-master-arts-ma","art")
A(AR,"English (Rhetoric and Communication Design)","英语（修辞与传播设计）","MA",W+"arts/english-rhetoric-and-communication-design-master-arts-ma","art")
A(AR,"English","英语","PhD",W+"arts/english-doctor-philosophy-phd","art")
A(AR,"Fine Arts (Studio Art)","美术（工作室艺术）","MFA",W+"arts/fine-arts-studio-art-master-fine-arts-mfa","art")
A(AR,"French Studies","法语研究","MA",W+"arts/french-studies-master-arts-ma","art")
A(AR,"French Studies","法语研究","PhD",W+"arts/french-studies-doctor-philosophy-phd","art")
A(AR,"German","德语","MA",W+"arts/german-master-arts-ma","art")
A(AR,"German (Intercultural German Studies)","德语（跨文化德语研究）","MA",W+"arts/german-intercultural-german-studies-master-arts-ma","art")
A(AR,"German","德语","PhD",W+"arts/german-doctor-philosophy-phd","art")
A(AR,"Global Governance","全球治理","MA",W+"arts/global-governance-master-arts-ma","soc")
A(AR,"Global Governance","全球治理","PhD",W+"arts/global-governance-doctor-philosophy-phd","soc")
A(AR,"History","历史学","MA",W+"arts/history-master-arts-ma","art")
A(AR,"History","历史学","PhD",W+"arts/history-doctor-philosophy-phd","art")
A(AR,"Peace and Conflict Studies","和平与冲突研究","MPACS",W+"arts/peace-and-conflict-studies-mpacs-master-peace-and-conflict","soc")
A(AR,"Philosophy","哲学","MA",W+"arts/philosophy-master-arts-ma","art")
A(AR,"Philosophy","哲学","PhD",W+"arts/philosophy-doctor-philosophy-phd","art")
A(AR,"Philosophy (Applied Philosophy)","哲学（应用哲学）","PhD",W+"arts/philosophy-applied-philosophy-doctor-philosophy-phd","art")
A(AR,"Political Science","政治学","MA",W+"arts/political-science-master-arts-ma","soc")
A(AR,"Political Science (Co-op)","政治学（带薪实习）","MA",W+"arts/political-science-co-op-master-arts-ma","soc")
A(AR,"Political Science","政治学","PhD",W+"arts/political-science-doctor-philosophy-phd","soc")
A(AR,"Psychology","心理学","MA",W+"arts/psychology-master-arts-ma","soc")
A(AR,"Psychology (Developmental and Communication Science)","心理学（发展与传播科学）","MASc",W+"arts/psychology-developmental-and-communication-science-master","soc")
A(AR,"Psychology (Industrial and Organizational Psychology)","心理学（工业与组织心理学）","MASc",W+"arts/psychology-industrial-and-organizational-psychology-master","soc")
A(AR,"Psychology","心理学","PhD",W+"arts/psychology-doctor-philosophy-phd","soc")
A(AR,"Public Service","公共服务","MPS",W+"arts/public-service-master-public-service-mps","soc")
A(AR,"Public Service (Co-op)","公共服务（带薪实习）","MPS",W+"arts/public-service-co-op-master-public-service-mps","soc")
A(AR,"Religion, Culture, and Society","宗教、文化与社会","PhD",W+"arts/religion-culture-and-society-doctor-philosophy-phd","art")
A(AR,"Social and Legal Studies","社会与法律研究","MA",W+"arts/social-and-legal-studies-master-arts-ma","soc")
A(AR,"Social and Legal Studies (Co-op)","社会与法律研究（带薪实习）","MA",W+"arts/social-and-legal-studies-co-op-master-arts-ma","soc")
A(AR,"Sociology","社会学","MA",W+"arts/sociology-master-arts-ma","soc")
A(AR,"Sociology","社会学","PhD",W+"arts/sociology-doctor-philosophy-phd","soc")
A(AR,"Taxation","税务","MTax",W+"arts/taxation-master-taxation-mtax","biz")
A(AR,"Taxation (Co-op)","税务（带薪实习）","MTax",W+"arts/taxation-co-op-master-taxation-mtax","biz")
A(AR,"Theological Studies","神学研究","MTS","https://uwaterloo.ca/future-graduate-students/programs/theological-studies-master-theological-studies-mts-conrad","art")

# ---- 工程学院 ----
A(EN,"Architecture","建筑学","MArch",W+"engineering/architecture-master-architecture-march","art")
A(EN,"Biomedical Engineering","生物医学工程","MASc",W+"engineering/biomedical-engineering-master-applied-science-masc","eng")
A(EN,"Biomedical Engineering","生物医学工程","PhD",W+"engineering/biomedical-engineering-doctor-philosophy-phd","eng")
A(EN,"Business, Entrepreneurship and Technology","商业、创业与技术","MBET",W+"engineering/business-entrepreneurship-and-technology-master-business","biz")
A(EN,"Business and Entrepreneurship","商业与创业","GDip",W+"engineering/business-and-entrepreneurship-graduate-diploma-gdip","biz")
A(EN,"Chemical Engineering","化学工程","MASc",W+"engineering/chemical-engineering-master-applied-science-masc","eng")
A(EN,"Chemical Engineering","化学工程","MEng",W+"engineering/chemical-engineering-master-engineering-meng","eng")
A(EN,"Chemical Engineering (Co-op)","化学工程（带薪实习）","MEng",W+"engineering/chemical-engineering-co-op-master-engineering-meng","eng")
A(EN,"Chemical Engineering","化学工程","PhD",W+"engineering/chemical-engineering-doctor-philosophy-phd","eng")
A(EN,"Civil Engineering","土木工程","MASc",W+"engineering/civil-engineering-master-applied-science-masc","eng")
A(EN,"Civil Engineering","土木工程","MEng",W+"engineering/civil-engineering-master-engineering-meng","eng")
A(EN,"Civil Engineering (Co-op)","土木工程（带薪实习）","MEng",W+"engineering/civil-engineering-co-op-master-engineering-meng","eng")
A(EN,"Civil Engineering","土木工程","PhD",W+"engineering/civil-engineering-doctor-philosophy-phd","eng")
A(EN,"Data Analytics","数据分析","GDip",W+"engineering/data-analytics-graduate-diploma-gdip","cs")
A(EN,"Electric Power Engineering (Online)","电力工程（在线）","GDip",W+"engineering/electric-power-engineering-graduate-diploma-gdip-online","eng")
A(EN,"Electrical and Computer Engineering","电子与计算机工程","MASc",W+"engineering/electrical-and-computer-engineering-master-applied-science","eng")
A(EN,"Electrical and Computer Engineering","电子与计算机工程","MEng",W+"engineering/electrical-and-computer-engineering-master-engineering-meng","eng")
A(EN,"Electrical and Computer Engineering (Co-op)","电子与计算机工程（带薪实习）","MEng",W+"engineering/electrical-and-computer-engineering-co-op-master-engineering","eng")
A(EN,"Electrical and Computer Engineering (Electric Power, Online)","电子与计算机工程（电力方向，在线）","MEng",W+"engineering/electrical-and-computer-engineering-electric-power","eng")
A(EN,"Electrical and Computer Engineering","电子与计算机工程","PhD",W+"engineering/electrical-and-computer-engineering-doctor-philosophy-phd","eng")
A(EN,"Entrepreneurship and Organization","创业与组织","PhD",W+"engineering/entrepreneurship-and-organization-doctor-philosophy-phd","biz")
A(EN,"Management Science and Engineering","管理科学与工程","MASc",W+"engineering/management-science-and-engineering-master-applied-science","eng")
A(EN,"Management Science and Engineering","管理科学与工程","PhD",W+"engineering/management-science-and-engineering-doctor-philosophy-phd","eng")
A(EN,"Management Science","管理科学","MMSc",W+"engineering/management-science-master-management-science-mmsc","biz")
A(EN,"Management Science (Co-op)","管理科学（带薪实习）","MMSc",W+"engineering/management-science-co-op-master-management-science-mmsc","biz")
A(EN,"Management Science (Business Analytics, Online)","管理科学（商业分析，在线）","MMSc",W+"engineering/management-science-business-analytics-master-management","biz")
A(EN,"Mechanical and Mechatronics Engineering","机械与机电工程","MASc",W+"engineering/mechanical-and-mechatronics-engineering-master-applied","eng")
A(EN,"Mechanical and Mechatronics Engineering","机械与机电工程","MEng",W+"engineering/mechanical-and-mechatronics-engineering-master-engineering","eng")
A(EN,"Mechanical and Mechatronics Engineering (Co-op)","机械与机电工程（带薪实习）","MEng",W+"engineering/mechanical-and-mechatronics-engineering-co-op-master","eng")
A(EN,"Mechanical and Mechatronics Engineering","机械与机电工程","PhD",W+"engineering/mechanical-and-mechatronics-engineering-doctor-philosophy","eng")
A(EN,"Systems Design Engineering","系统设计工程","MASc",W+"engineering/systems-design-engineering-master-applied-science-masc","eng")
A(EN,"Systems Design Engineering","系统设计工程","MEng",W+"engineering/systems-design-engineering-master-engineering-meng","eng")
A(EN,"Systems Design Engineering","系统设计工程","PhD",W+"engineering/systems-design-engineering-doctor-philosophy-phd","eng")

# ---- 环境学院 ----
A(EV,"Climate Change","气候变化","MCC",W+"environment/climate-change-master-climate-change-mcc","sci")
A(EV,"Climate Risk Management (Online)","气候风险管理（在线）","GDip",W+"environment/climate-risk-management-graduate-diploma-gdip-online","sci")
A(EV,"Development Practice","发展实践","MDP",W+"environment/development-practice-master-development-practice-mdp","soc")
A(EV,"Economic Development and Innovation","经济发展与创新","MEDI",W+"environment/economic-development-and-innovation-master-economic","biz")
A(EV,"Environment and Business (Online)","环境与商业（在线）","MEB",W+"environment/environment-and-business-master-environment-and-business-meb","biz")
A(EV,"Future Cities (Online)","未来城市（在线）","MFC",W+"environment/future-cities-master-future-cities-mfc-online","soc")
A(EV,"Geography","地理学","MA",W+"environment/geography-master-arts-ma","sci")
A(EV,"Geography","地理学","MES",W+"environment/geography-master-environmental-studies-mes","sci")
A(EV,"Geography","地理学","MSc",W+"environment/geography-master-science-msc","sci")
A(EV,"Geography","地理学","PhD",W+"environment/geography-doctor-philosophy-phd","sci")
A(EV,"Planning","规划学","MA",W+"environment/planning-master-arts-ma","soc")
A(EV,"Planning","规划学","MES",W+"environment/planning-master-environmental-studies-mes","soc")
A(EV,"Planning","规划学","PhD",W+"environment/planning-doctor-philosophy-phd","soc")
A(EV,"Social and Ecological Sustainability","社会与生态可持续性","MES",W+"environment/social-and-ecological-sustainability-master-environmental","sci")
A(EV,"Social and Ecological Sustainability","社会与生态可持续性","PhD",W+"environment/social-and-ecological-sustainability-doctor-philosophy-phd","sci")
A(EV,"Sustainability Management","可持续性管理","MES",W+"environment/sustainability-management-master-environmental-studies-mes","sci")
A(EV,"Sustainability Management","可持续性管理","PhD",W+"environment/sustainability-management-doctor-philosophy-phd","sci")

# ---- 健康学院 ----
A(HE,"Health Evaluation (Online)","健康评估（在线）","MHE",W+"health/health-evaluation-master-health-evaluation-mhe-online","med")
A(HE,"Health Informatics and Analytics","健康信息学与分析","MHIA",W+"health/health-informatics-and-analytics-master-health-informatics","med")
A(HE,"Kinesiology","运动机能学","MKin",W+"health/kinesiology-master-kinesiology-mkin","med")
A(HE,"Kinesiology and Health Sciences","运动机能学与健康科学","MSc",W+"health/kinesiology-and-health-sciences-master-science-msc","med")
A(HE,"Kinesiology and Health Sciences","运动机能学与健康科学","PhD",W+"health/kinesiology-and-health-sciences-doctor-philosophy-phd","med")
A(HE,"Public Health (Online)","公共卫生（在线）","MPH",W+"health/public-health-master-public-health-mph-online","med")
A(HE,"Public Health Sciences","公共卫生科学","MSc",W+"health/public-health-sciences-master-science-msc","med")
A(HE,"Public Health Sciences","公共卫生科学","PhD",W+"health/public-health-sciences-doctor-philosophy-phd","med")
A(HE,"Recreation and Leisure Studies","休闲与游憩研究","MA",W+"health/recreation-and-leisure-studies-master-arts-ma","soc")
A(HE,"Recreation and Leisure Studies","休闲与游憩研究","PhD",W+"health/recreation-and-leisure-studies-doctor-philosophy-phd","soc")
A(HE,"Social Work (Online)","社会工作（在线）","MSW",W+"health/social-work-master-social-work-msw-online","soc")
A(HE,"Sport and Recreation Leadership (Online)","体育与休闲领导力（在线）","MA",W+"health/sport-and-recreation-leadership-master-arts-ma-online","soc")

# ---- 数学学院 ----
A(MA,"Actuarial Science (Co-op)","精算学（带薪实习）","MActSc",W+"mathematics/actuarial-science-co-op-master-actuarial-science-mactsc","biz")
A(MA,"Actuarial Science","精算学","MMath",W+"math/actuarial-science-master-math-mmath","biz")
A(MA,"Actuarial Science and Quantitative Finance","精算与量化金融","PhD",W+"mathematics/actuarial-science-and-quantitative-finance-doctor-philosophy","sci")
A(MA,"Applied Mathematics","应用数学","MMath",W+"math/applied-mathematics-master-math-mmath","sci")
A(MA,"Applied Mathematics","应用数学","PhD",W+"math/applied-mathematics-doctor-philosophy-phd","sci")
A(MA,"Biostatistics","生物统计","MMath",W+"math/biostatistics-master-math-mmath","sci")
A(MA,"Combinatorics and Optimization","组合与优化","MMath",W+"math/combinatorics-and-optimization-master-math-mmath","sci")
A(MA,"Combinatorics and Optimization (Co-op)","组合与优化（带薪实习）","MMath",W+"math/combinatorics-and-optimization-co-op-master-mathematics","sci")
A(MA,"Combinatorics and Optimization","组合与优化","PhD",W+"math/combinatorics-and-optimization-doctor-philosophy-phd","sci")
A(MA,"Computational Mathematics","计算数学","MMath",W+"math/computational-mathematics-master-mathematics-mmath","sci")
A(MA,"Computational Mathematics (Co-op)","计算数学（带薪实习）","MMath",W+"math/computational-mathematics-co-op-master-mathematics-mmath","sci")
A(MA,"Computer Science","计算机科学","MMath",W+"math/computer-science-master-math-mmath","cs")
A(MA,"Computer Science","计算机科学","PhD",W+"math/computer-science-doctor-philosophy-phd","cs")
A(MA,"Cybersecurity and Privacy (Co-op)","网络安全与隐私（带薪实习）","MCP",W+"mathematics/cybersecurity-and-privacy-co-op-master","cs")
A(MA,"Data Science","数据科学","MMath",W+"math/data-science-master-math-mmath","cs")
A(MA,"Data Science and Artificial Intelligence","数据科学与人工智能","MDSAI",W+"math/data-science-and-artificial-intelligence-master-data-science","cs")
A(MA,"Data Science and Artificial Intelligence (Co-op)","数据科学与人工智能（带薪实习）","MDSAI",W+"math/data-science-and-artificial-intelligence-co-op-master-data","cs")
A(MA,"Mathematics for Teachers (Online)","数学教师方向（在线）","MMT",W+"mathematics/mathematics-teachers-master-mathematics-teachers-mmt-online","edu")
A(MA,"Pure Mathematics","纯数学","MMath",W+"math/pure-mathematics-master-mathematics-mmath","sci")
A(MA,"Pure Mathematics","纯数学","PhD",W+"math/pure-mathematics-doctor-philosophy-phd","sci")
A(MA,"Quantitative Finance","量化金融","MQF",W+"mathematics/quantitative-finance-master-quantitative-finance-mqf","biz")
A(MA,"Statistics","统计学","MMath",W+"math/statistics-master-math-mmath","sci")
A(MA,"Statistics","统计学","PhD",W+"math/statistics-doctor-philosophy-phd","sci")

# ---- 理学院 ----
A(SC,"Biology","生物学","MSc",W+"science/biology-master-science-msc","sci")
A(SC,"Biology","生物学","PhD",W+"science/biology-doctor-philosophy-phd","sci")
A(SC,"Chemistry","化学","MSc",W+"science/chemistry-master-science-msc","sci")
A(SC,"Chemistry (Co-op)","化学（带薪实习）","MSc",W+"science/chemistry-co-op-master-science-msc","sci")
A(SC,"Chemistry","化学","PhD",W+"science/chemistry-doctor-philosophy-phd","sci")
A(SC,"Earth Sciences","地球科学","MSc",W+"science/earth-sciences-master-science-msc","sci")
A(SC,"Earth Sciences","地球科学","PhD",W+"science/earth-sciences-doctor-philosophy-phd","sci")
A(SC,"Pharmacy","药学","MSc",W+"science/pharmacy-master-science-msc","med")
A(SC,"Pharmacy","药学","PhD",W+"science/pharmacy-doctor-philosophy-phd","med")
A(SC,"Physics","物理学","MSc",W+"science/physics-master-science-msc","sci")
A(SC,"Physics","物理学","PhD",W+"science/physics-doctor-philosophy-phd","sci")
A(SC,"Vision Science","视觉科学","MSc",W+"science/vision-science-master-science-msc","med")
A(SC,"Vision Science","视觉科学","PhD",W+"science/vision-science-doctor-philosophy-phd","med")

A("跨院系","Digital Experience Innovation (Online)","数字体验创新（在线）","MDEI","https://uwaterloo.ca/future-graduate-students/node/334","art")

def q(x): return '"' + str(x).replace('\\','\\\\').replace('"','\\"') + '"'
block = "\n".join("[" + ", ".join(q(c) for c in r) + "]," for r in rows) + "\n"
anchor = "];\nconst DOCDEG"
assert anchor in s
s = s.replace(anchor, block + "];\nconst DOCDEG", 1)
io.open(P,"w",encoding="utf-8").write(s)
print("inserted", len(rows))
