Jupyter Notebook拒绝在字符串中打印下划线。
task_line = '### [TASK] Building the app for wonders \n'
task_pattern = "# [TASK]"
task_name = task_line.split(task_pattern)[-1].strip()
task_name.replace(" ", "_")
打印:'Building_the_app_for_wonders'
但是,一个精简的示例可以正确替换:
task_name = 'Building the app for wonders'
task_name.replace(" ", "_")
打印:'Building_the_app_for_wonders'
这是什么原因?