如果解决了您的问题请采纳!
如果未解决请继续追问
如果您想在pycharm中去除中括号,您可以按照以下步骤操作:
打开pycharm,打开要操作的Python文件。
在pycharm的菜单栏中,点击“File”菜单,选择“Settings”。
在“Settings”窗口中,在左侧的导航栏中,找到“Editor”选项,并点击进入。
在“Editor”选项中,点击“Code Style”选项,在右侧的“Python”标签页中,找到“Wrapping and Braces”选项。
在“Wrapping and Braces”中,找到“Do not wrap”选项,并勾选“Array literal”和“Tuple literal”两个选项。
这样,在您按下“Enter”键时,pycharm就会自动去除中括号,让您的代码更加简洁。
注意:上述操作会改变pycharm的代码格式设置,如果您不想更改默认的设置,可以在“Code Style”中创建一个新的代码样式,并在“Wrapping and Braces”中进行相应的设置,这样您可以保留默认的代码样式,同时为特定文件设置不同的代码样式。
from bs4 import BeautifulSouphtml = """
<cite class="CitationContent" id="CR1">
Anderson, C. (2008). The end of theory: The data deluge makes the scientific method obsolete.
<em class="EmphasisTypeItalic">Wired,</em>
<em class="EmphasisTypeItalic">16</em>, 07.
</cite>
"""
soup = BeautifulSoup(html, 'html5lib')
print soup.find('cite').get_text()