Câu hỏi được gắn thẻ «python-2.7»

Python 2.7 là phiên bản chính cuối cùng trong sê-ri 2.x và không còn được duy trì kể từ ngày 1 tháng 1 năm 2020. Không sử dụng thẻ này đơn giản để truyền tải phiên bản Python bạn đang sử dụng, trừ khi câu hỏi liên quan đến vấn đề cụ thể đối với Python 2.7. Sử dụng thẻ [python] chung chung hơn.

5
Python Lưu vào tệp
Tôi muốn lưu một chuỗi vào tệp bằng chương trình python có tên Failed.py Đây là những gì tôi có cho đến nay: myFile = open('today','r') ips = {} for line in myFile: parts = line.split(' ') if parts[1] == 'Failure': if parts[0] in ips: ips[pars[0]] += 1 else: ips[parts[0]] …


3
sự khác biệt giữa tìm kiếm và chỉ mục
Tôi mới sử dụng python và không thể hiểu được sự khác biệt giữa tìm và chỉ mục. >>> line 'hi, this is ABC oh my god!!' >>> line.find("o") 16 >>> line.index("o") 16 Chúng luôn trả về cùng một kết quả. Cảm ơn!!

15
RuntimeError: mô-đun được biên dịch dựa trên phiên bản API a nhưng phiên bản numpy này là 9
Mã: import numpy as np import cv Bảng điều khiển: >>> runfile('/Users/isaiahnields/.spyder2/temp.py', wdir='/Users/isaiahnields/.spyder2') RuntimeError: module compiled against API version a but this version of numpy is 9 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile execfile(filename, namespace) File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 78, …


2
aws cli: ERROR: root: code cho hàm băm md5 không tìm thấy
Khi thử chạy AWS CLI, tôi gặp lỗi này: aws ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 ERROR:root:code …


Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.