img = soup.find_all('img')
The result is a lt; img> Array of tags, using get() to get <; img> The SRC
src=img[2].get('src')
img = soup.find_all('img')
The result is a lt; img> Array of tags, using get() to get <; img> The SRC
src=img[2].get('src')
soup>
soup>
soup>
soup>
soup>
soup>
soup>
soup>
soup
The elements of the
soup. Select (‘ #author ‘) from author
soup.select(‘.notice ‘
soup. Select (‘ div span)
Between the
soup. Select (‘ div> Span ‘)
Between the
Select (‘ input[type= ‘button’] ‘) from
soup.
soup.
soup
BeautifulSoup4 retrieves the value of the class attribute of the tag
Recently, when I was writing a crawler, I suddenly needed to determine whether the class value of the current tag was a specific value. After searching online, I found that it was not very helpful, so I made a note of it.
Using the GET method
html = BeautifulSoup(request,'lxml')
a = html.find_all('a')
for i in a:
if (i.get('class') == 'xxx'):
url = i.get('href')
return url
return None
The above code has the following functions:
When reading a CSV file using pd.read_csv(), the following error occurs:
UnicodeDecodeError: ‘UTF-8’ codec can’t decode byte 0xD0 in position 0: invalid continuation byte
The file is not encoded in UTF8, and the system uses UTF8 decoding by default. The solution is to change the corresponding decoding mode.
Solutions:
select encoding a drop-down box, choose the required encoding UTF8, re-save can
finally to run the code, the problem is resolved ol>
Using urllib in Python 3 is an error like this:
Traceback (most recent call last):
File "*.py", line 34, in <module>
html_page = get(URL, req_header)
File "*.py", line 18, in get_HTML
request = urllib.request.Request(url, headers=req_header)
AttributeError: module 'urllib' has no attribute 'request'
An error code
import urllib
request = urllib.request.Request(url, headers=req_header)
html = urllib.request.urlopen(request).read()
print (html)
Error reason:
in the Python AttributeError code> errors there are two kinds of main reason: >
1.
2. File with same name exists in project directory
> port urllib.request <>ode>
import urllib
import urllib.request
request = urllib.request.Request(url, headers=req_header)
html = urllib.request.urlopen(request).read()
print (html)
Error ‘res’ is assigned a value but never used no-unused-vars
Error reason: eslint validation syntax error
the solution: error the bank notes /
// eslint-disable-line no-unused-vars
In the file & gt; > > > Preferences Settings> > > > > Search for eslint

* in Settings. Json and add the following code to the outer braces.
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"eslint.autoFixOnSave" : true,
},
After the file is saved, you can fix the code automatically.
Disadvantages: The server cannot actively invalidate the token
2. Centralized Redis Token/Memory Session, etc
Advantages: The server can actively invalidate the token
Cons: Redis queries need to be done every time. Occupying Redis storage space.
Here Redis stores a whitelist of tokens. Other information about the user is also stored in Redis. It takes up a lot of Redis space and queries.
3. Optimization scheme:
Here, Redis only stores the blacklist of TokenID, and Redis can also be distributed with separate reads and writes. Token authenticates the server to operate on Redis’ master, and other Redis synchronize the master’s data
https://www.zhihu.com/question/274566992
Run Ubuntu 16.04 in VMware to solve the full-screen problem
Run the following command in the terminal:
Problem orientation
In fact, the specific issue of the official seven years ago (reference), but the more pit is that the official has not solved the problem. Simply put, a bug in the JRE running environment of IDEA causes the input method to be unable to locate the mouse position. Therefore, we need to modify the running code of JetBrainsRuntime to fix this problem.
The solution
Modify JetBrainsRuntime
Change your own JRE directory
/home/ XXX /idea-2020.1/bin/idea.shhome/XXX /idea-2020.1/bin/idea.sh
port IDEA_JDK=/home/ XXX /idea-2020.1/java-11.0.7-jetbrain.>r> export IDEA_JDK=/home/ XXX /idea-2020.1/java-11.0.7-jetbrain
Appendix:
JetBrainsRuntime