刚刚安装了 BeautifulSoup Python 3.3.0 [英] Just installed BeautifulSoup Python 3.3.0

查看:19
本文介绍了刚刚安装了 BeautifulSoup Python 3.3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何解决它.我使用的是 Mac OS 10.8.2

<预><代码>>>>从 bs4 导入 BeautifulSoup回溯(最近一次调用最后一次):文件<stdin>",第 1 行,在 <module> 中文件/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/bs4/__init__.py",第359行打印汤.美化()^语法错误:无效语法

解决方案

在 Python 3 中 print 是一个函数;应该是:

print(soup.prettify())

正确安装 bs4 或者如果它是一个错误,请使用更新的版本.beautifulsoup4==4.1.3 在 Python 3.3 上运行良好.

Does anyone know how to fix it. I am using Mac OS 10.8.2

>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/bs4/__init__.py", line 359
    print soup.prettify()
             ^
SyntaxError: invalid syntax

解决方案

In Python 3 print is a function; it should be:

print(soup.prettify())

Install bs4 correctly or use a newer version if it is a bug. beautifulsoup4==4.1.3 works fine on Python 3.3.

这篇关于刚刚安装了 BeautifulSoup Python 3.3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆