源:
#coding:utf-8
a=['春季','夏季','秋季','日食','冬季']
for e in a:
e.remove('日食')
print(e)
图:
控件PyCharm社区版
这咋了???
Python 3.10.0b3 (tags/v3.10.0b3:865714a, Jun 17 2021, 20:39:25) [MSC v.1929 64 bit (AMD64)] on win32
runfile('C:/Users/Admin/PycharmProjects/pythonProject1/main.py', wdir='C:/Users/Admin/PycharmProjects/pythonProject1')
Traceback (most recent call last):
File "", line 1, in
File "D:\BaiduNetdiskDownload\PyCharm Community Edition 2021.1.2\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\BaiduNetdiskDownload\PyCharm Community Edition 2021.1.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"n", file, 'exec'), glob, loc)
File "C:/Users/Admin/PycharmProjects/pythonProject1/main.py", line 4, in
e.remove('日食')
AttributeError: 'str' object has no attribute 'remove'
带湿们解释解释
求了!!
python3.10,不是3.6!!!
这是导入AST的结果:
C:\Users\Admin>pip install --user AST
Fatal error in launcher: Unable to create process using '"c:\users\tarena\desktop\python-3.6.4-embed-win32\python.exe" "C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\Scripts\pip.exe" install --user AST'
C:\Users\Admin>pip /?
Fatal error in launcher: Unable to create process using '"c:\users\tarena\desktop\python-3.6.4-embed-win32\python.exe" "C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\Scripts\pip.exe" /?'
C:\Users\Admin>pip?
'pip?' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:\Users\Admin>pip ?
Fatal error in launcher: Unable to create process using '"c:\users\tarena\desktop\python-3.6.4-embed-win32\python.exe" "C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\Scripts\pip.exe" ?'
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>
C:\Users\Admin>cd C:\Windows\system32
C:\Windows\System32>pip /?
Fatal error in launcher: Unable to create process using '"c:\users\tarena\desktop\python-3.6.4-embed-win32\python.exe" "C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\Scripts\pip.exe" /?'
C:\Windows\System32>python -m pip install -user AST
Usage:
C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\python.exe -m pip install [options] [package-index-options] ...
C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\python.exe -m pip install [options] -r [package-index-options] ...
C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\python.exe -m pip install [options] [-e] ...
C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\python.exe -m pip install [options] [-e] ...
C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\python.exe -m pip install [options] <archive url/path> ...
no such option: -u
C:\Windows\System32>python -m -u pip install -user AST
C:\Users\Admin\AppData\Roaming\tc\python-3.6.4\python.exe: No module named -u
C:\Windows\System32>
```
小白在线求解啊!!!!!!!