python 爬虫 too many values to unpack (expected 2) 20C
import urllib.request as ur

header =( "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 QIHU 360EE")

opener = ur.build_opener()

url = "https://www.jianshu.com/p/2d8e4416c077"

data = opener.open(url).read()

报错
报错
报错

ValueError                                Traceback (most recent call last)
<ipython-input-63-36e685c3559f> in <module>
      1 url = "https://www.jianshu.com/p/2d8e4416c077"
----> 2 data = opener.open(url).read()

D:\softs\anaconda\lib\urllib\request.py in open(self, fullurl, data, timeout)
    521         for processor in self.process_request.get(protocol, []):
    522             meth = getattr(processor, meth_name)
--> 523             req = meth(req)
    524 
    525         response = self._open(req, data)

D:\softs\anaconda\lib\urllib\request.py in do_request_(self, request)
   1266         if not request.has_header('Host'):
   1267             request.add_unredirected_header('Host', sel_host)
-> 1268         for name, value in self.parent.addheaders:
   1269             name = name.capitalize()
   1270             if not request.has_header(name):

ValueError: too many values to unpack (expected 2)

请问如何解决?

3个回答

name, value= opener.open(url).read() 就不会报错了

weixin_38644431
一豪叔叔 依然报错啊,这个我也试过
3 个月之前 回复

你把self.parent.addheaders 输出打印一下,看看具体是什么格式的的数据。然后在选取你要获取的字段

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ValueError: too many values to unpack (expected 2)
网上说是元素找不到对应的 代码如下: ``` import turtle file=open("C:/Users/jyz_1/Desktop/新建文本文档.txt") file=file.read() lines=file.split("重庆") i=0 lsy=[] for line in lines: #index the temprature inn=line.index('\n')#The first \n inc=line.index("C")#The first C if i==0: tu=int(line[line.find('\n',inn+1)+1:inc])#The second \n if "~" in line: tl=int(line[line.index('~')+1:line.rindex('C')]) else: tl=tu i=i+1 else: fn=line.find('\n',inn+1) tu=int(line[line.find('\n',fn+1)+1:inc])#The third \n if "~" in line: tl=int(line[line.index('~')+1:line.rindex('C')]) else: tl=tu t=(tl+tu)/2#daily average temprature lsy.append(t) #find the date lsx=[] dates=file.split("\n") for date in dates: if "-" in date: if date.replace("-","").isnumeric()==True: p1=date.index('-')#the first - p2=date.find('-',p1+1)#the second - month=date[p1+1:p2] day=date[p2+1:] date_on_x=int(month+day) lsx.append(date_on_x) #draw axis def drawx(): turtle.pu() turtle.goto(-50,-50) turtle.pd() turtle.fd(240) def drawy(): turtle.pu() turtle.goto(-50,-50) turtle.seth(90) turtle.pd() turtle.fd(160) #comment the axis def comx(): turtle.pu() turtle.goto(-50,-65) turtle.seth(0) for i in range(1,13): turtle.write(i) turtle.fd(20) def comy(): turtle.pu() turtle.goto(-75,-50) turtle.seth(90) for i in range(-30,51,10): turtle.write(float(i)) turtle.fd(20) #draw the rainbow def rainbow(): #define the color if t<8: turtle.color("purple") elif 8<=t<12: turtle.color("lightblue") elif 12<=t<22: turtle.color("green") elif 22<=t<28: turtle.color("yellow") elif 28<=t<30: turtle.color("orange") elif t>=30: turtle.color("red") #let's draw! for x,t in lsx,lsy: turtle.pu() turtle.goto(x,t) turtle.pd() turtle.circle(10) drawx() drawy() comx() comy() rainbow() ``` 报错: ``` Traceback (most recent call last): File "C:\Users\jyz_1\AppData\Local\Programs\Python\Python37-32\32rx.py", line 92, in <module> rainbow(t) File "C:\Users\jyz_1\AppData\Local\Programs\Python\Python37-32\32rx.py", line 83, in rainbow for x,t in lsx,lsy: ValueError: too many values to unpack (expected 2) ``` 但是我用len发现lsx,lsy长度相同 也就是说,lsx,lsy中的元素一一对应 那这个报错是怎么回事?
too many values to unpack 错误
python 3.6,用urllib库尝试爬取url url="http://blog.csdn.net/weiwei_pig/article/details/51178226" headers=("User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/ 537.36") opener=urllib.request.build_opener() opener.addheaders=[headers] data=opener.open(url).read() 错误提示如下: Traceback (most recent call last): File "/Users/nathanlu/PycharmProjects/learn/spider.py", line 27, in <module> data=opener.open(url).read() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 524, in open req = meth(req) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1269, in do_request_ for name, value in self.parent.addheaders: ValueError: too many values to unpack (expected 2) 请问什么原因?
python调用cv2.findContours时报错:ValueError: not enough values to unpack (expected 3, got 2)
完整代码如下: ``` import cv2 import numpy as np img = np.zeros((200, 200), dtype=np.uint8) img[50:150, 50:150] = 255 ret, thresh = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY) image, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) color = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) img = cv2.drawContours(color, contours, -1, (0,255,0), 2) cv2.imshow("contours", color) cv2.waitKey() cv2.destroyAllWindows() ``` 但是cv2.findContours报如下错误: ValueError: not enough values to unpack (expected 3, got 2) python版本为3.6,opencv为4.0.0
如何正确地遍历列表?
例如:x=[1,2,3] y=[4,5,6] 输出(1,4),(2,5),(3,6) 用for循环会发生valueError报错 ``` Traceback (most recent call last): File "<pyshell#11>", line 1, in <module> for a,b in x,y: ValueError: too many values to unpack (expected 2) ``` 请求正确的解决方式
Python 报错: not enough values to unpack (expected 3, got 1),该怎么解决?求大神解决!
![图片说明](https://img-ask.csdn.net/upload/201910/22/1571745918_625213.png)![图片说明](https://img-ask.csdn.net/upload/201910/22/1571745931_336418.png) 代码如下: # -*- coding:utf-8 -*- import numpy as np import pandas as pd from collections import Counter from sklearn import preprocessing import scipy import sys import os path1=os.path.abspath('.') print(path1) name=pd.read_table("genotype.sav",header=0,sep=',') print(name) print(name.columns) for i in name.columns: a,b,c=Counter(name[i]).keys() if a[0]==a[1]: #print(keys[0],keys[1]) name[i].replace(a, 0, inplace=True) name[i].replace(b, 1, inplace=True) name[i].replace(c, 2, inplace=True) elif a[0]!=a[1]: name[i].replace(a, 1, inplace=True) name[i].replace(b, 0, inplace=True) name[i].replace(c, 2, inplace=True) #print(keys) #print(name[i]) name.to_csv('rename.csv') #recode_ID()
collocations 函数使用过程中遇到 Error
在直接上手使用《用 Python进行自然语言处理》一书中第39 页的例子时,出现了如下的ValueError,不知道什么情况,请大神帮忙解答,谢谢! >>> text4.collocations() Traceback (most recent call last): File "<pyshell#9>", line 1, in <module> text4.collocations() File "/Users/jiamingxie/Library/Python/3.7/lib/python/site-packages/nltk/text.py", line 444, in collocations w1 + " " + w2 for w1, w2 in self.collocation_list(num, window_size) File "/Users/jiamingxie/Library/Python/3.7/lib/python/site-packages/nltk/text.py", line 444, in <listcomp> w1 + " " + w2 for w1, w2 in self.collocation_list(num, window_size) ValueError: too many values to unpack (expected 2)
Python-爬虫下载图片时报错
我写了一个简单的python(python3.5)爬虫 网站用代码可以访问 但是用 **_urllib.request.urlretrieve _**时出现了以下错误 **_ValueError: not enough values to unpack (expected 2, got 1)_** 我已经确认这是 下载那一行出的错了 但不知道为什么会这样报错 ![图片说明](https://img-ask.csdn.net/upload/201708/17/1502940585_15928.jpg) ![图片说明](https://img-ask.csdn.net/upload/201708/17/1502940695_821913.jpg) **求解决方法** **小白在此谢过!**
python 安装 pymssql 库时报错
安装第三方库 ``` pip install pymssql Traceback (most recent call last): File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcher yield File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in read data = self._fp.read(amt) if not fp_closed else b"" File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read data = self.__fp.read(amt) File "c:\users\XXX\appdata\local\programs\python\python37\lib\http\client.py", line 457, in read n = self.readinto(b) File "c:\users\XXX\appdata\local\programs\python\python37\lib\http\client.py", line 501, in readinto n = self.fp.readinto(b) File "c:\users\XXX\appdata\local\programs\python\python37\lib\socket.py", line 589, in readinto return self._sock.recv_into(b) File "c:\users\XXX\appdata\local\programs\python\python37\lib\ssl.py", line 1071, in recv_into return self.read(nbytes, buffer) File "c:\users\XXX\appdata\local\programs\python\python37\lib\ssl.py", line 929, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 153, in _main status = self.run(options, args) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\commands\install.py", line 382, in run resolver.resolve(requirement_set) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 201, in resolve self._resolve_one(requirement_set, req) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 365, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 313, in _get_abstract_dist_for req, self.session, self.finder, self.require_hashes File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\operations\prepare.py", line 194, in prepare_linked_requirement progress_bar=self.progress_bar File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 465, in unpack_url progress_bar=progress_bar File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 316, in unpack_http_url progress_bar) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 551, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 253, in _download_url hashes.check_against_chunks(downloaded_chunks) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\utils\hashes.py", line 80, in check_against_chunks for chunk in chunks: File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 223, in written_chunks for chunk in chunks: File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\utils\ui.py", line 160, in iter for x in it: File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 212, in resp_read decode_content=False): File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 564, in stream data = self.read(amt=amt, decode_content=decode_content) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 529, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "c:\users\XXX\appdata\local\programs\python\python37\lib\contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 430, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out. ``` 也下载了 wordcloud-1.6.0-cp37-cp37m-win_amd64.whl python版本是3.7 64位
pip升级怎么提示这个 怎么 解决 老版本也删除了 我的是python 3.7
``` D:\python>python -m pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl (1.4MB) 1% |▌ | 20kB 1.4kB/s eta 0:16:35Exception: Traceback (most recent call last): File "D:\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 302, in _error_catcher yield File "D:\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 384, in read data = self._fp.read(amt) File "D:\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read data = self.__fp.read(amt) File "D:\python\lib\http\client.py", line 447, in read n = self.readinto(b) File "D:\python\lib\http\client.py", line 491, in readinto n = self.fp.readinto(b) File "D:\python\lib\socket.py", line 589, in readinto return self._sock.recv_into(b) File "D:\python\lib\ssl.py", line 1049, in recv_into return self.read(nbytes, buffer) File "D:\python\lib\ssl.py", line 908, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\python\lib\site-packages\pip\_internal\basecommand.py", line 228, in main status = self.run(options, args) File "D:\python\lib\site-packages\pip\_internal\commands\install.py", line 291, in run resolver.resolve(requirement_set) File "D:\python\lib\site-packages\pip\_internal\resolve.py", line 103, in resolve self._resolve_one(requirement_set, req) File "D:\python\lib\site-packages\pip\_internal\resolve.py", line 257, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "D:\python\lib\site-packages\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for self.require_hashes File "D:\python\lib\site-packages\pip\_internal\operations\prepare.py", line 310, in prepare_linked_requirement progress_bar=self.progress_bar File "D:\python\lib\site-packages\pip\_internal\download.py", line 837, in unpack_url progress_bar=progress_bar File "D:\python\lib\site-packages\pip\_internal\download.py", line 674, in unpack_http_url progress_bar) File "D:\python\lib\site-packages\pip\_internal\download.py", line 898, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "D:\python\lib\site-packages\pip\_internal\download.py", line 618, in _download_url hashes.check_against_chunks(downloaded_chunks) File "D:\python\lib\site-packages\pip\_internal\utils\hashes.py", line 48, in check_against_chunks for chunk in chunks: File "D:\python\lib\site-packages\pip\_internal\download.py", line 586, in written_chunks for chunk in chunks: File "D:\python\lib\site-packages\pip\_internal\utils\ui.py", line 159, in iter for x in it: File "D:\python\lib\site-packages\pip\_internal\download.py", line 575, in resp_read decode_content=False): File "D:\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 436, in stream data = self.read(amt=amt, decode_content=decode_content) File "D:\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 401, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "D:\python\lib\contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "D:\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 307, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. ```
在win10子系统ubuntu18.04下安装mysql5.7尝试重新启动的时候出现以下报错
在win10子系统ubuntu18.04下安装mysql5.7尝试重新启动的时候出现以下报错 1.安装mysql-server ``` root@PC-5200:/home/tom# apt-get -y install mysql-server ``` ``` Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libfreetype6 Use 'apt autoremove' to remove it. The following additional packages will be installed: libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-6 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libssl1.1 libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 Suggested packages: libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca The following NEW packages will be installed: libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-6 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7 The following packages will be upgraded: libssl1.1 1 upgraded, 21 newly installed, 0 to remove and 136 not upgraded. Need to get 21.0 MB of archives. After this operation, 157 MB of additional disk space will be used. Get:1 http://mirrors.aliyun.com/ubuntu bionic/main amd64 mysql-common all 5.8+1.0.4 [7308 B] Get:2 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6476 B] Get:3 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 libssl1.1 amd64 1.1.1-1ubuntu2.1~18.04.5 [1300 kB] Get:4 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 mysql-client-core-5.7 amd64 5.7.28-0ubuntu0.18.04.4 [6644 kB] Get:5 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 mysql-client-5.7 amd64 5.7.28-0ubuntu0.18.04.4 [1943 kB] Get:6 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 mysql-server-core-5.7 amd64 5.7.28-0ubuntu0.18.04.4 [7432 kB] Get:7 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libevent-core-2.1-6 amd64 2.1.8-stable-4build1 [85.9 kB] Get:8 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 mysql-server-5.7 amd64 5.7.28-0ubuntu0.18.04.4 [2932 kB] Get:9 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhtml-tagset-perl all 3.20-3 [12.1 kB] Get:10 http://mirrors.aliyun.com/ubuntu bionic/main amd64 liburi-perl all 1.73-1 [77.2 kB] Get:11 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhtml-parser-perl amd64 3.72-3build1 [85.9 kB] Get:12 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libcgi-pm-perl all 4.38-1 [185 kB] Get:13 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libfcgi-perl amd64 0.78-2build1 [32.8 kB] Get:14 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libcgi-fast-perl all 1:2.13-1 [9940 B] Get:15 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libencode-locale-perl all 1.05-1 [12.3 kB] Get:16 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhtml-template-perl all 2.97-1 [59.0 kB] Get:17 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB] Get:18 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhttp-date-perl all 6.02-1 [10.4 kB] Get:19 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libio-html-perl all 1.001-1 [14.9 kB] Get:20 http://mirrors.aliyun.com/ubuntu bionic/main amd64 liblwp-mediatypes-perl all 6.02-1 [21.7 kB] Get:21 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhttp-message-perl all 6.14-1 [72.1 kB] Get:22 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 mysql-server all 5.7.28-0ubuntu0.18.04.4 [9940 B] Fetched 21.0 MB in 9s (2376 kB/s) Preconfiguring packages ... Selecting previously unselected package mysql-common. (Reading database ... 28663 files and directories currently installed.) Preparing to unpack .../0-mysql-common_5.8+1.0.4_all.deb ... Unpacking mysql-common (5.8+1.0.4) ... Selecting previously unselected package libaio1:amd64. Preparing to unpack .../1-libaio1_0.3.110-5ubuntu0.1_amd64.deb ... Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) ... Preparing to unpack .../2-libssl1.1_1.1.1-1ubuntu2.1~18.04.5_amd64.deb ... Unpacking libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.5) over (1.1.0g-2ubuntu4.3) ... Selecting previously unselected package mysql-client-core-5.7. Preparing to unpack .../3-mysql-client-core-5.7_5.7.28-0ubuntu0.18.04.4_amd64.deb ... Unpacking mysql-client-core-5.7 (5.7.28-0ubuntu0.18.04.4) ... Selecting previously unselected package mysql-client-5.7. Preparing to unpack .../4-mysql-client-5.7_5.7.28-0ubuntu0.18.04.4_amd64.deb ... Unpacking mysql-client-5.7 (5.7.28-0ubuntu0.18.04.4) ... Selecting previously unselected package mysql-server-core-5.7. Preparing to unpack .../5-mysql-server-core-5.7_5.7.28-0ubuntu0.18.04.4_amd64.deb ... Unpacking mysql-server-core-5.7 (5.7.28-0ubuntu0.18.04.4) ... Selecting previously unselected package libevent-core-2.1-6:amd64. Preparing to unpack .../6-libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb ... Unpacking libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ... Setting up mysql-common (5.8+1.0.4) ... update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode Selecting previously unselected package mysql-server-5.7. (Reading database ... 28832 files and directories currently installed.) Preparing to unpack .../00-mysql-server-5.7_5.7.28-0ubuntu0.18.04.4_amd64.deb ... Unpacking mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ... Selecting previously unselected package libhtml-tagset-perl. Preparing to unpack .../01-libhtml-tagset-perl_3.20-3_all.deb ... Unpacking libhtml-tagset-perl (3.20-3) ... Selecting previously unselected package liburi-perl. Preparing to unpack .../02-liburi-perl_1.73-1_all.deb ... Unpacking liburi-perl (1.73-1) ... Selecting previously unselected package libhtml-parser-perl. Preparing to unpack .../03-libhtml-parser-perl_3.72-3build1_amd64.deb ... Unpacking libhtml-parser-perl (3.72-3build1) ... Selecting previously unselected package libcgi-pm-perl. Preparing to unpack .../04-libcgi-pm-perl_4.38-1_all.deb ... Unpacking libcgi-pm-perl (4.38-1) ... Selecting previously unselected package libfcgi-perl. Preparing to unpack .../05-libfcgi-perl_0.78-2build1_amd64.deb ... Unpacking libfcgi-perl (0.78-2build1) ... Selecting previously unselected package libcgi-fast-perl. Preparing to unpack .../06-libcgi-fast-perl_1%3a2.13-1_all.deb ... Unpacking libcgi-fast-perl (1:2.13-1) ... Selecting previously unselected package libencode-locale-perl. Preparing to unpack .../07-libencode-locale-perl_1.05-1_all.deb ... Unpacking libencode-locale-perl (1.05-1) ... Selecting previously unselected package libhtml-template-perl. Preparing to unpack .../08-libhtml-template-perl_2.97-1_all.deb ... Unpacking libhtml-template-perl (2.97-1) ... Selecting previously unselected package libtimedate-perl. Preparing to unpack .../09-libtimedate-perl_2.3000-2_all.deb ... Unpacking libtimedate-perl (2.3000-2) ... Selecting previously unselected package libhttp-date-perl. Preparing to unpack .../10-libhttp-date-perl_6.02-1_all.deb ... Unpacking libhttp-date-perl (6.02-1) ... Selecting previously unselected package libio-html-perl. Preparing to unpack .../11-libio-html-perl_1.001-1_all.deb ... Unpacking libio-html-perl (1.001-1) ... Selecting previously unselected package liblwp-mediatypes-perl. Preparing to unpack .../12-liblwp-mediatypes-perl_6.02-1_all.deb ... Unpacking liblwp-mediatypes-perl (6.02-1) ... Selecting previously unselected package libhttp-message-perl. Preparing to unpack .../13-libhttp-message-perl_6.14-1_all.deb ... Unpacking libhttp-message-perl (6.14-1) ... Selecting previously unselected package mysql-server. Preparing to unpack .../14-mysql-server_5.7.28-0ubuntu0.18.04.4_all.deb ... Unpacking mysql-server (5.7.28-0ubuntu0.18.04.4) ... Setting up libhtml-tagset-perl (3.20-3) ... Setting up libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ... Processing triggers for ureadahead (0.100.0-21) ... Setting up libencode-locale-perl (1.05-1) ... Setting up libtimedate-perl (2.3000-2) ... Setting up libio-html-perl (1.001-1) ... Setting up liblwp-mediatypes-perl (6.02-1) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Setting up libaio1:amd64 (0.3.110-5ubuntu0.1) ... Setting up liburi-perl (1.73-1) ... Setting up libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.5) ... Checking for services that may need to be restarted...done. Checking for services that may need to be restarted...done. Checking init scripts... Restarting services possibly affected by the upgrade: invoke-rc.d: could not determine current runlevel Services restarted successfully. Processing triggers for systemd (237-3ubuntu10.21) ... Setting up libhtml-parser-perl (3.72-3build1) ... Setting up libcgi-pm-perl (4.38-1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Setting up mysql-client-core-5.7 (5.7.28-0ubuntu0.18.04.4) ... Setting up libfcgi-perl (0.78-2build1) ... Setting up libhttp-date-perl (6.02-1) ... Setting up libhtml-template-perl (2.97-1) ... Setting up mysql-server-core-5.7 (5.7.28-0ubuntu0.18.04.4) ... Setting up libcgi-fast-perl (1:2.13-1) ... Setting up libhttp-message-perl (6.14-1) ... Setting up mysql-client-5.7 (5.7.28-0ubuntu0.18.04.4) ... Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ... invoke-rc.d: could not determine current runlevel * Stopping MySQL database server mysqld [ OK ] update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode Renaming removed key_buffer and myisam-recover options (if present) Cannot open /proc/net/unix: No such file or directory Cannot stat file /proc/1/fd/5: Operation not permitted Cannot stat file /proc/1/fd/10: Operation not permitted Cannot stat file /proc/1/fd/6: Operation not permitted Cannot stat file /proc/7/fd/7: Operation not permitted Cannot stat file /proc/7/fd/10: Operation not permitted Cannot stat file /proc/7/fd/5: Operation not permitted Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service. invoke-rc.d: could not determine current runlevel Setting up mysql-server (5.7.28-0ubuntu0.18.04.4) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for ureadahead (0.100.0-21) ... Processing triggers for systemd (237-3ubuntu10.21) ... ``` 2.启动mysql服务 ``` root@PC-5200:/home/tom# systemctl start mysql.service ``` 3.出现如下报错 ``` System has not been booted with systemd as init system (PID 1). Can't operate. ```
Python脚本运行问题,在pycharm中运行会出错
初学python,写了一段脚本: from sys import argv script,user_name=argv prompt='<' print("hi %s,i am the %s script."%(user_name,script)) print("I'd like to ask you a few questions.") print("DO you like me %s"%user_name) input(prompt) 在Pycharm上面运行会出现如下错误: D:\PycharmProjects\untitled\venv\Scripts\python.exe D:/PycharmProjects/untitled/ex14.py Traceback (most recent call last): File "D:/PycharmProjects/untitled/ex14.py", line 2, in <module> script,user_name=argv ValueError: not enough values to unpack (expected 2, got 1) Process finished with exit code 1 这是什么原因,用cmd运行就没有问题,可以出来结果
本方法学python 练习14报错
from sys import argv script,user_name = argv prompt = '> ' print("Hi %s,I'm the %s script."%(user_name,script)) print("I'd like to ask you s few questions.") print("Do you like me %s?"%user_name) likes = input(prompt) print("Where do you like %s?"%user_name) lives = input(prompt) print("What kind of computer do you have?") computer = input(prompt) print(""" Alright,so you said %r about liking me. You libe in %r.Not sure where that is. And you have a %r computer.Nice. """ %(likes,lives,computer)) 报错: Traceback (most recent call last): File "ex14.py", line 3, in <module> script,user_name = argv ValueError: not enough values to unpack (expected 2, got 1)
Python统计一个文件内所有文档的总行数
RT,好像没什么好说的了,代码如下,显示错误为 ValueError: not enough values to unpack (expected 2, got 1) 请帮忙看看应该怎么修改 ``` import numpy as np from numpy import array import os ID=[] readfile='F:\\FCD\\01' file=os.listdir(readfile) for ifile in file: f=open(readfile+'\\'+ifile) a=f.readlines() for line in a: ID.append(line.split(',')) n=np.array(ID) [rows,cols]=n.shape w=open('F:\\FCD\\01\\01.txt','a') w.write('%d/n'%rows) w.close() ```
急!!!请教各位大神python报这个错怎么解?
from sys import argv script,user_name = argv prompt = '> ' print("Hi %s,I'm the %s script."%(user_name,script)) print("I'd like to ask you s few questions.") print("Do you like me %s?"%user_name) likes = input(prompt) print("Where do you like %s?"%user_name) lives = input(prompt) print("What kind of computer do you have?") computer = input(prompt) print(""" Alright,so you said %r about liking me. You libe in %r.Not sure where that is. And you have a %r computer.Nice. """ %(likes,lives,computer)) 报错: Traceback (most recent call last): File "ex14.py", line 3, in script,user_name = argv ValueError: not enough values to unpack (expected 2, got 1)
用linux安装软件出现的问题 ERROR: Exception: Traceback (most recent call last)
edx@ubuntu:~$ git clone https://github.com/kan-bayashi/PytorchWaveNetVocoder.git 正克隆到 'PytorchWaveNetVocoder'... remote: Enumerating objects: 330, done. remote: Counting objects: 100% (330/330), done. remote: Compressing objects: 100% (159/159), done. remote: Total 2328 (delta 220), reused 258 (delta 171), pack-reused 1998 接收对象中: 100% (2328/2328), 436.01 KiB | 736.00 KiB/s, 完成. 处理 delta 中: 100% (1436/1436), 完成. edx@ubuntu:~$ cd PytorchWaveNetVocoder/tools edx@ubuntu:~/PytorchWaveNetVocoder/tools$ make test -d venv || virtualenv -p python3.6 venv Running virtualenv with interpreter /usr/bin/python3.6 Using base prefix '/usr' New python executable in /home/edx/PytorchWaveNetVocoder/tools/venv/bin/python3.6 Also creating executable in /home/edx/PytorchWaveNetVocoder/tools/venv/bin/python Installing setuptools, pkg_resources, pip, wheel...done. . venv/bin/activate && pip install --upgrade pip Requirement already up-to-date: pip in ./venv/lib/python3.6/site-packages (19.3.1) . venv/bin/activate && cd ../ && pip install torch==1.0.1 torchvision==0.2.2 Collecting torch==1.0.1 Downloading https://files.pythonhosted.org/packages/f7/92/1ae072a56665e36e81046d5fb8a2f39c7728c25c21df1777486c49b179ae/torch-1.0.1-cp36-cp36m-manylinux1_x86_64.whl (560.0MB) |████████████████████████████████| 560.0MB 98kB/s eta 0:00:01ERROR: Exception: Traceback (most recent call last): File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 153, in _main status = self.run(options, args) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 382, in run resolver.resolve(requirement_set) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve self._resolve_one(requirement_set, req) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for req, self.session, self.finder, self.require_hashes File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 194, in prepare_linked_requirement progress_bar=self.progress_bar File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 465, in unpack_url progress_bar=progress_bar File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 316, in unpack_http_url progress_bar) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 551, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 253, in _download_url hashes.check_against_chunks(downloaded_chunks) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/utils/hashes.py", line 80, in check_against_chunks for chunk in chunks: File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 223, in written_chunks for chunk in chunks: File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/utils/ui.py", line 160, in iter for x in it: File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 212, in resp_read decode_content=False): File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream data = self.read(amt=amt, decode_content=decode_content) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 507, in read data = self._fp.read(amt) if not fp_closed else b"" File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 65, in read self._close() File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 52, in _close self.__callback(self.__buf.getvalue()) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py", line 300, in cache_response cache_url, self.serializer.dumps(request, response, body=body) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/serialize.py", line 72, in dumps return b",".join([b"cc=4", msgpack.dumps(data, use_bin_type=True)]) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/__init__.py", line 46, in packb return Packer(**kwargs).pack(o) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/fallback.py", line 900, in pack self._pack(obj) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/fallback.py", line 891, in _pack nest_limit - 1) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/fallback.py", line 985, in _pack_map_pairs self._pack(v, nest_limit - 1) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/fallback.py", line 891, in _pack nest_limit - 1) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/fallback.py", line 984, in _pack_map_pairs self._pack(k, nest_limit - 1) File "/home/edx/PytorchWaveNetVocoder/tools/venv/lib/python3.6/site-packages/pip/_vendor/msgpack/fallback.py", line 847, in _pack return self._buffer.write(obj) MemoryError Makefile:6: recipe for target 'venv/bin/activate' failed make: *** [venv/bin/activate] Error 2 这是运行出来的错误 ,因为时第一次使用,所以没有看懂什么意思,想求助大佬们,怎么解决![图片说明](https://img-ask.csdn.net/upload/201911/07/1573114791_122624.png)这是代码运行make的文件程序
Java socket 接收数据包解析问题
我想实现的效果是,第一次接收4个字节,然后判断是否为包头,如果是包头就进行下一步,但是在限制字节,byte[] tmpHead = new byte[4]还有判断包头的时候总出错。初学者,基础不扎实,请大佬赐教。 ``` DataInputStream is =new DataInputStream(socket.getInputStream());//实例化 byte[] tmpHead = new byte[4];//接收包头 is.read(tmpHead);//将拿到的值给tmpHead if(is.read(tmpHead) != 0){ toastMsg("收到了"); }else { toastMsg("没有"); } if ((tmpHead[0] == 0x7E) && (tmpHead[1] == 0x81) && (tmpHead[2] == 0x18) && (tmpHead[3] == 0xE7)) {//判断包头 toastMsg("头验证"); byte[] tmpRest = new byte[44];//接收后续数据 is.read(tmpRest);//将拿到的值给tmpRest byte[] Head = new byte[tmpHead.length + tmpRest.length];//拼接完整包头 System.arraycopy(tmpHead, 0, Head, 0, tmpHead.length);//合并数组 System.arraycopy(tmpRest, 0, Head, tmpHead.length, tmpRest.length);//合并数组 struct.InfoHead mInfoHead = new struct.InfoHead();//JavaStruct 对象实例化 JavaStruct.unpack(mInfoHead, Head);//unpack解包 byte[] Data = new byte[mInfoHead.dataLen];//拿到Struct包中datalen,获取下段字节长度 is.read(Data);//将拿到的值给Data byte[] Tail = new byte[8];//包尾长度8字节 is.read(Tail);//将获取的数据给Tail struct.Tail mTail = new struct.Tail();//实例化Tail JavaStruct.unpack(mTail, Tail);//解包 if (mTail.packTail == 0x8F9009F8) {//判断包尾是否正确 System.out.print(mInfoHead.packHead); System.out.print(mTail.packTail); } } else { toastMsg("数据错误"); } } catch (Exception e) { e.printStackTrace(); } } }).start(); ```
安装python setuptools出错
python ez_setup.py 安装setuptools出错: 提示如下: Traceback (most recent call last): File "setup.py", line 169, in <module> dist = setuptools.setup(**setup_params) File "/usr/lib/python2.7/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/setuptools/dist.py", line 272, in __init__ _Distribution.__init__(self,attrs) File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__ self.finalize_options() File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/setuptools/dist.py", line 326, in finalize_options ep.require(installer=self.fetch_build_egg) File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 2385, in require reqs = self.dist.requires(self.extras) File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 2617, in requires dm = self._dep_map File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 2606, in _dep_map if invalid_marker(marker): File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 1424, in is_invalid_marker cls.evaluate_marker(text) File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 1549, in _markerlib_evaluate env = cls._translate_metadata2(_markerlib.default_environment()) File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 1537, in _translate_metadata2 for key, value in env File "/home/huangay/samba/trunkcode/sita_trunk/core/tplayer/src/package/apps/drm_plugin/3rds/widevine/3rds/setuptools/setuptools-18.5/pkg_resources/__init__.py", line 1536, in <genexpr> (key.replace('.', '_'), value) **ValueError: too many values to unpack** 大神们帮忙分析分析啊
笨办法学python3习题41学习面向对象术语的代码正确,但运行总是出现错误
代码是可以正常运行的,但是总是在循环了不超过两三个问题时就出错,有时第一次就会出错。 出错时提示ValueError: not enough values to unpack (expected 2, got 0),这个时候convert(snippet, phrase)返回的results是一个空列表,为请问什么循环过程中会出现这种情况? import random from urllib.request import urlopen import sys WORD_URL = "http://learncodethehardway.org/words.txt" WORDS = [] PHRASES = { "class %%%(%%%):": "Make a class named %%% that is-a %%%.", "class %%%(object):\n\tdef __init__(self, ***)": "class %%% has-a __init__ that takes self and *** params.", "class %%%(object):\n\tdef ***(self, @@@)": "class %%% has-a function *** that takes self and @@@ params.", "*** = %%%()": "Set *** to an instance of class %%%.", "***.***(@@@)": "From *** get the *** function, call it with params self, @@@.", "***.*** = '***'": "From *** get the *** attribute and set it to '***'." } if len(sys.argv) == 2 and sys.argv[1] == "english": PHRASES_FRIST = True else: PHRASES_FRIST = False for word in urlopen(WORD_URL).readlines(): WORDS.append(str(word.strip(), encoding = "utf-8")) def convert(snippet, phrase): class_names = [w.capitalize() for w in random.sample(WORDS, snippet.count("%%%"))] other_names = random.sample(WORDS, snippet.count("***")) results = [] param_names = [] for i in range(0, snippet.count("@@@")): param_count = random.randint(1, 3) param_names.append(', '.join( random.sample(WORDS, param_count))) for sentence in snippet, phrase: result = sentence[:] for word in class_names: result = result.replace("%%%", word, 1) for word in other_names: result = result.replace("***", word, 1) for word in param_names: result = result.replace("@@@", word, 1) results.append(result) return results try: while True: snippets = list(PHRASES.keys()) print(">>>>> ", repr(snippets)) random.shuffle(snippets) print(">>>>> ", repr(snippets)) for snippet in snippets: phrase = PHRASES[snippet] print(">>>>> ", repr(convert(snippet, phrase))) question, answer = convert(snippet, phrase) if PHRASES_FRIST: question, answer = answer, question print(question) input("> ") print(f"Answer: {answer}\n\n") except EOFError: print("\nBye")
pyecharts模块使用遇到了问题——使用geo地理图表,抛出TypeError: cannot unpack non-iterable NoneType object的异常
![图片说明](https://img-ask.csdn.net/upload/201910/06/1570346918_249397.png) ![图片说明](https://img-ask.csdn.net/upload/201910/06/1570346961_352887.png) 为什么用list来作为地图的数据会报错,但是用generator就正常呢?官方文档的demo也是用list的 pyecharts官方文档 https://pyecharts.org/#/zh-cn/geography_charts?id=geo%ef%bc%9a%e5%9c%b0%e7%90%86%e5%9d%90%e6%a0%87%e7%b3%bb
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
兼职程序员一般可以从什么平台接私活?
这个问题我进行了系统性的总结,以下将进行言简意赅的说明和渠道提供,希望对各位小猿/小媛们有帮助~ 根据我们的经验,程序员兼职主要分为三种:兼职职位众包、项目整包和自由职业者驻场。 所谓的兼职职位众包,指的是需求方这边有自有工程师配合,只需要某个职位的工程师开发某个模块的项目。比如开发一个 app,后端接口有人开发,但是缺少 iOS 前端开发工程师,那么他们就会发布一个职位招聘前端,来配合公司一...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
写了很久,这是一份最适合/贴切普通大众/科班/非科班的『学习路线』
说实话,对于学习路线这种文章我一般是不写的,大家看我的文章也知道,我是很少写建议别人怎么样怎么样的文章,更多的是,写自己的真实经历,然后供大家去参考,这样子,我内心也比较踏实,也不怕误导他人。 但是,最近好多人问我学习路线,而且很多大一大二的,说自己很迷茫,看到我那篇 普普通通,我的三年大学 之后很受激励,觉得自己也能行,(是的,别太浪,你一定能行)希望我能给他个学习路线,说
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
致 Python 初学者
文章目录1. 前言2. 明确学习目标,不急于求成,不好高骛远3. 在开始学习 Python 之前,你需要做一些准备2.1 Python 的各种发行版2.2 安装 Python2.3 选择一款趁手的开发工具3. 习惯使用IDLE,这是学习python最好的方式4. 严格遵从编码规范5. 代码的运行、调试5. 模块管理5.1 同时安装了py2/py35.2 使用Anaconda,或者通过IDE来安装模
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
碎片化的时代,如何学习
今天周末,和大家聊聊学习这件事情。 在如今这个社会,我们的时间被各类 APP 撕的粉碎。 刷知乎、刷微博、刷朋友圈; 看论坛、看博客、看公号; 等等形形色色的信息和知识获取方式一个都不错过。 貌似学了很多,但是却感觉没什么用。 要解决上面这些问题,首先要分清楚一点,什么是信息,什么是知识。 那什么是信息呢? 你一切听到的、看到的,都是信息,比如微博上的明星出轨、微信中的表情大战、抖音上的...
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。 背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法 不过,当我看了源代码之后 这程序不到50行 尽管我有多年的Python经验,但我竟然一时也没有看懂 当然啦,原作者也说了,这个代码也是在无聊中诞生的,平时撸码是不写中文变量名的, 中文...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
相关热词 如何提升c#开发能力 矩阵乘法c# c#调用谷歌浏览器 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天
立即提问

相似问题

2
linux运行PHP报错 : alloc error:mem_delta == (uint32_t)mem_delta
0
Ubuntu18安装MongoDB报错,更新时报错。
2
python 3.7引用docx操作word文档报错exception 该怎么办?
2
想写一个有21个输入,一个输出的神经网络,数据在txt中,以空格分开,读入数据部分该如何写?
4
python调用cv2.findContours时报错:ValueError: not enough values to unpack (expected 3, got 2)
3
python打包exe出错:Struct.error 希望高人能指导下。感谢了
0
pyqt5 使用多线程进行socket通信,界面未响应后程序退出
4
求助:CUDA的RuntimeError:cuda runtime error (30)
0
ubuntu16.04安装opencv时,make不通过该怎么办?
1
卷积神经网络中,用Im2col实现卷积层,但是在调用convolution类时报错
0
Ubuntu19.04 安装 libpng12-0 出错
2
collocations 函数使用过程中遇到 Error
1
卷积神经网络训练图片报错未定义和没有足够的值解包
0
笨办法学python3习题41学习面向对象术语的代码正确,但运行总是出现错误
1
pip3 install ERROR: Exception: Traceback (most recent call last)
4
pip升级怎么提示这个 怎么 解决 老版本也删除了 我的是python 3.7
1
sorted 函数bug,有没有大神帮忙指点下这是什么错误
2
pyecharts模块使用遇到了问题——使用geo地理图表,抛出TypeError: cannot unpack non-iterable NoneType object的异常
2
ubuntu 19.04 遇到了libpng12.so.0 导致无法apt 更新
1
Python 报错: not enough values to unpack (expected 3, got 1),该怎么解决?求大神解决!