小编agn*_*nel的帖子

ImportError:错误'不是包'

在python 3中遇到ImportError问题.我的项目结构如下:

cts_sap_polaris/                                                                     
|-- etc                                                                              
|   |-- clean_cts_sap_polaris.yaml                                                   
|   |-- clean_env_variables.tcl                                                      
|   |-- cts_sap_polaris_ha_combined.yaml                                             
|   |-- cts_sap_polaris.yaml                                                         
|   `-- TCL_TESTBED_CONFIGS                                                          
|-- __init__.py                                                                      
|-- jobs
|   |-- __init__.py
|   |-- __pycache__
|   |   `-- run_cts_sap_polaris.cpython-34.pyc
|   `-- run_cts_sap_polaris.py
|-- lib
|   |-- cli_check.py
|   |-- cts_sap_polaris_utils.py
|   |-- __init__.py
|   |-- router_show_cts_cmd.py
|   |-- router_show_etherchannel_cmd.py
|   |-- router_show.py
|   |-- utils.py
|   |-- validate_show_output.py
|   `-- wait_for.py
|-- scripts
|   |-- cts_sap_polaris_ha_combined.py
|   |-- cts_sap_polaris.py
|   |-- __init__.py
|   `-- __pycache__ …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

11
推荐指数
2
解决办法
2万
查看次数

python字符串在单引号前添加反斜杠

我有一个字符串,其中包含这样的引号:

string = "\"This is my mom's vase\", said Kevin."
Run Code Online (Sandbox Code Playgroud)

问题是当我将它用作 python 中的字符串时,它会在单引号前添加一个反斜杠,如下所示:

>>> string
'"This is my mom\'s vase", said Kevin.'
>>>
Run Code Online (Sandbox Code Playgroud)

为什么会发生这种情况,我该怎么办?

python string quotes

2
推荐指数
1
解决办法
4398
查看次数

标签 统计

python ×2

python-3.x ×1

quotes ×1

string ×1