![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
Drscq
STRIVE FOR MY DREAM
展开
-
Creating a Random Permutation with Fixed Indices in Python
【代码】Creating a Random Permutation with Fixed Indices in Python。原创 2024-03-07 06:47:05 · 920 阅读 · 0 评论 -
Managing Dynamic Global Variables in Python
【代码】Managing Dynamic Global Variables in Python。原创 2024-03-03 07:04:38 · 900 阅读 · 1 评论 -
459. Repeated Substring Pattern
s。原创 2023-03-19 16:11:15 · 309 阅读 · 0 评论 -
28. Find the Index of the First Occurrence in a string
Given two strings and , return the index of the first occurrence of in , or -1 if is not part of .Example 1:Input: = “sadbutsad”, = “sad”Output: 0Explanation: “sad” occurs at index 0 and 6. The first occurrence is at index 0, so we return 0.Example原创 2023-03-19 10:09:09 · 379 阅读 · 0 评论 -
The Modification for BERT Model
【代码】The Modification for BERT Model。原创 2023-03-15 23:20:38 · 59 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
【代码】26. Remove Duplicates from Sorted Array。原创 2023-03-14 10:11:24 · 177 阅读 · 0 评论 -
214. Shortest Palindrome
s。原创 2023-03-13 21:55:29 · 46 阅读 · 0 评论 -
What is the mean of super() in class inheritance?
【代码】What is the mean of super() in class inheritance?原创 2023-03-01 16:39:44 · 61 阅读 · 0 评论 -
Project_1 Replace the Embedding layer in Transformer or BERT
Owing to only some of the entries in embedding layers updating during each batch training, it is implerative that we can just store the updating entries in the memory and outsourced the left data to other places.原创 2022-12-12 12:02:51 · 137 阅读 · 1 评论 -
The Steps to prepare the Remote Device and necessary packages for Deep Learning
【代码】The Steps to prepare the Remote Device and necessary packages for Deep Learning。原创 2022-11-25 15:55:17 · 888 阅读 · 0 评论 -
Addictive and Subtractive Properties of Shamir Secret Sharing (Shamir秘密共享的半同态加密的性质(加性和减性))
The reultsThe Example 2 to show its subtractive propertyCorresponding ResultsThe example to use larger number to substract the less numberResults原创 2022-11-21 15:20:38 · 161 阅读 · 0 评论 -
The basic use of matplotlib and numpy in python
The basic uses for drawing graphs in python原创 2022-07-03 18:40:00 · 84 阅读 · 0 评论 -
check your computer‘s wireless connection and the try to auto login
The code 1def check_wifi_connection() -> bool: """ check the status of the wifi or wire connection :return: True if connected, False if not """ connected = False try: # check the status of the wifi connection imp原创 2022-05-25 20:53:22 · 214 阅读 · 0 评论 -
How to minimize the cost function of linear regression by gradient descent
The description of the problemNext, you will implement gradient descent in the file gradientDescent.m. The loop structure has been written for you, and you only need to supply the updates to within each iteration.As you program, make sure you underst原创 2022-05-21 15:23:43 · 137 阅读 · 0 评论 -
Good way to solve the problem with space in filename
The description of problemI was ready to open tengxunhuiyi in windows in python.I just write the following codes.import os# use os open 腾讯会议os.system("start C:\\Program Files (x86)\\Tencent\\WeMeet\\wemeetapp.exe")however, I got the follwing error:原创 2022-04-16 21:11:57 · 546 阅读 · 0 评论 -
facilitate the processes adjusting related parameters by easy.py
step_1 just download two database files svmguide1 and svmguide1.t into a file containing easy.py liking following:step_2 use command python3 easy.py svmguide1 svmguide1.t and I just got the followign mistakes:the solutions to handle the above problems:原创 2022-03-25 17:21:36 · 3045 阅读 · 0 评论 -
How to Use libsvm in linux with Ubuntu (installation and test)
step_1 Download the original sources from websiteyou could click it or use the command wgetthen you will get the file like following:step_2 decompress the download file into “libsvm-3.25”use the command tar -zxvf libsvm-3.25.tar.gz and you will get原创 2022-03-24 16:13:22 · 2633 阅读 · 1 评论 -
How to use GitHub actions to execute your python codes automatically with secrets variables
As I just know, the GitHub actions has a function that could execute your scripts automatically. The next will illustrate how to achieve that:|step_1 You should be familiar with the basic uses of GitHub actions firstly.step_2 You will make a file and wr原创 2022-01-03 12:39:00 · 149 阅读 · 0 评论 -
how to get structure and content of data in post function
step_1 open your browser with the website you want to access and click button F12, you will get the following picture:step_2 clink the element in header named Network and tag the Preserve logstep_3 commit your access request in web pagestep_...原创 2021-12-26 19:23:45 · 135 阅读 · 0 评论 -
how to find dynamic token in html
background for this problem:I just would like to use python to log in东莞理工学院中央认证系统 (dgut.edu.cn).At begining, I want to use request.session.post with my account name and password to log in, but I just found the following stuff:which means that I a..原创 2021-12-26 19:10:09 · 236 阅读 · 0 评论 -
2021-11-04 anaconda 无法用官方命令产生python=3.6的运行环境的解决方法
这个是我已经修改了下载的网址,上面的网址是清华镜像的网站,这个网址的修改可以看.condarc(conda 配置文件)、换国内源 - stardsd - 博客园这个链接。并且你可以用conda config --show-sources这个命令看一下你的anaconda的下载地址。Anaconda建立新的环境,出现CondaHTTPError: HTTP 000 CONNECTION FAILED for url ...... 解决过程 - tianlang25 - 博客园这篇文章..原创 2021-11-04 11:48:01 · 1158 阅读 · 0 评论 -
How to use the numpy generate a random matrix
The results:[[ 6 7 8 9 10 11] [12 13 14 15 16 17] [30 31 32 33 34 35] [18 19 20 21 22 23] [24 25 26 27 28 29] [ 0 1 2 3 4 5]]The codes:import numpy as nparr = np.arange(36).reshape((6, 6))np.random.shuffle(arr)print(arr)reference:原创 2021-10-21 11:17:46 · 69 阅读 · 0 评论 -
How to log in a website and return some info
The outputs:runfile('C:/Users/孙长启/Documents/GitHub/DGUT-yqfk/untitled0.py', wdir='C:/Users/孙长启/Documents/GitHub/DGUT-yqfk') [SUCCESS] 登陆验证成功The codes: # -*- coding: utf-8 -*-"""Created on Fri Oct 1 12:09:31 2021@author: 孙长启"""import re原创 2021-10-01 18:26:17 · 189 阅读 · 0 评论 -
2021-06-23How to transfer int number into date
when I got some data from the tushare API, I found that the data in trade_date column cannot be convert into the date type by using the to_datetime in pandas.For example:The data in trade_date is like 20200306. but I would like to change it into the 2.原创 2021-06-23 09:09:30 · 91 阅读 · 0 评论 -
How to integrate two data set of dictionary
There are two kinds dictionary, one of them containing {'sz":'000001'}原创 2021-06-14 09:41:27 · 71 阅读 · 0 评论 -
The function of ** before a dictionary and * before a tuple
** could translate the key-value pair into valuee.g.The 1 + 2 = 3The co原创 2021-06-14 09:27:02 · 56 阅读 · 0 评论 -
How to avoid the ‘traceback‘
Q1:use the try excpet order to show a friendly interactive interface with your users.原创 2021-06-08 00:02:37 · 56 阅读 · 0 评论 -
Address a problem to distinguish two states
The output:原创 2021-06-04 11:13:12 · 231 阅读 · 0 评论 -
Show 50 numbers after the point of pi
The output:3.14159265358979323846264338327950288419716939937510...1000002The codes:原创 2021-06-01 19:28:17 · 51 阅读 · 0 评论 -
The python codes about ‘files‘
Q 1:1 step:create a file with a name:pi_digits.txt containing 30 numbers after the point.2 step:open this file and print it on the screen The output:原创 2021-06-01 18:20:50 · 54 阅读 · 0 评论 -
Modify the list in the Function, exciting!
Pass the list into the funciton which you can modify it. Particularly, the any changes in this process is原创 2021-05-29 09:25:26 · 103 阅读 · 0 评论 -
practices for ‘while‘ and ‘break‘
Q1. Use a function to generate a full name with input of first name and last name. and use while原创 2021-05-28 21:52:52 · 42 阅读 · 0 评论 -
when ‘while‘ meets the ‘function‘
Q1, Let a dictionary collect the pet's name and pet's type, and print it all in the way that "I have a dog. My dog's name is Willie."The output:Input the name of the pet.aliceInput the type of the pet.dogContinue to input or not. yes/noswitch = y原创 2021-05-28 08:45:35 · 89 阅读 · 0 评论 -
The Magic of Function
Q1: Output the 9*9 list twice:The Output:1*1=1 2*1=2 2*2=4 3*1=3 3*2=6 3*3=9 4*1=4 4*2=8 4*3=12 4*4=16 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36 7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49 8*1=8 8*2=1原创 2021-05-27 18:35:26 · 36 阅读 · 0 评论 -
The combination of ‘while‘ and ‘list‘
Q1: There is a list contianing the names of the account that has not been verfied. This list is called unconfirmed_users. We should transfer the name in the unconfirmed_users into the confirmed users. And print them out.The output:Verifying user:Cand.原创 2021-05-27 18:03:25 · 259 阅读 · 0 评论 -
The use of ‘while‘ and ‘if‘ and ‘break‘ and ‘Continue‘
Q1; hint that "Tell me something, and I will repeat it back to you." + "Enter 'quit' to end the program."The output:Tell me something, and I will repeat it back to you:Enter "quit" to end the program.I lvoe you.I lvoe you.Tell me something, and I原创 2021-05-27 17:14:38 · 53 阅读 · 0 评论 -
The practices for ‘input()‘
Q1: Make a programme that could request the kind of car the users will use and print "Let me see if I can find you a subaru"name_car = input('What kind of car you want:\n')print('Let me see if I can find you a '+name_car)The output:What kind of car原创 2021-05-25 10:40:28 · 50 阅读 · 0 评论 -
‘while‘ and ‘input()‘ in python
Q1.Let the users input 'Tell me somehing and I will repeat it back to you.'The code:message = input('Tell me something, and I will repeat it back to you.')print(message)The output:Tell me something, and I will repeat it back to you: hellohello原创 2021-05-25 10:17:29 · 41 阅读 · 0 评论 -
The Uses of ‘while‘ and‘input‘
The OUTPUT:Tell me something, and I will repeat it back to you: Enter 'quit' to end the program.Hello world.Hello world.Tell me something, and I will repeat it back to you: Enter 'quit' to end the program.I love you I love you Tell me somethin原创 2021-05-22 22:30:52 · 57 阅读 · 0 评论 -
The data storage structure of dictionary
Iterate through the elements in the dictionaryThe output:Key:username Value:sunnyKey:lastname Value:sunKey:firstname Value:changqiThe Codes:user_0 = { 'username':'sunny', 'lastname':'sun', 'firstname':'changqi', }for key,valu原创 2021-05-20 22:50:45 · 44 阅读 · 0 评论