ImportError: cannot import name 'ascii_letters' from 'string' python debug报错

Traceback (most recent call last):
  File "D:\Python\Pycharm\PyCharm Community Edition with Anaconda plugin 2019.2.2\helpers\pydev\pydevd.py", line 20, in <module>
    from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PYCHARM, get_thread_id, get_current_thread_id, \
  File "D:\Python\Pycharm\PyCharm Community Edition with Anaconda plugin 2019.2.2\helpers\pydev\_pydevd_bundle\pydevd_constants.py", line 179, in <module>
    from _pydev_imps._pydev_saved_modules import thread
  File "D:\Python\Pycharm\PyCharm Community Edition with Anaconda plugin 2019.2.2\helpers\pydev\_pydev_imps\_pydev_saved_modules.py", line 21, in <module>
    import xmlrpc.client as xmlrpclib
  File "D:\Python\Python\lib\xmlrpc\client.py", line 136, in <module>
    import http.client
  File "D:\Python\Python\lib\http\client.py", line 71, in <module>
    import email.parser
  File "D:\Python\Python\lib\email\parser.py", line 12, in <module>
    from email.feedparser import FeedParser, BytesFeedParser
  File "D:\Python\Python\lib\email\feedparser.py", line 27, in <module>
    from email._policybase import compat32
  File "D:\Python\Python\lib\email\_policybase.py", line 7, in <module>
    from email import header
  File "D:\Python\Python\lib\email\header.py", line 16, in <module>
    import email.quoprimime
  File "D:\Python\Python\lib\email\quoprimime.py", line 44, in <module>
    from string import ascii_letters, digits, hexdigits
ImportError: cannot import name 'ascii_letters' from 'string' (D:\Python\Project\string.py)

出错原因:

项目文件中有文件名是string.py的文件

解决方法:

把文件名替换成其他的就可以了    比如首字母大写String.py

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值