为啥在jupyter运行没有结果

from bs4 import BeautifulSoup
import requests
import time

headers={
'Uster-Agent':'Mozilla/5.0(Windows NT 6.1;WOW64) AppleWebKit/537.36(KHTML,like Gecko) Cheom/53.0.2785.143 Safri/537.6'
}

def judgment_sex(class_name):
if class_name ==['member_icol']:
return '女'
else:
return '男'

def get_links(url):
wb_data =requests.get(url,headers=headers)
soup= BeautifulSoup (wb_data.text,'lxml')
links=soup.select('#page_list>ul>li>a')
for link in links:
href =link.get("href")
get_info(href)

def get_info (url):
wb_data=requests.get(url,headers=headers)
soup=BeautifulSoup(wb_data.texr,'lxml')
titles=soup.select('div.pho_info>h4')
addresses=soup.select('span.pro5')
prices=soup.select('#pricePart>div.day_1>span')
imgs=soup.select('#floatRightBox>div.js>box.clearfix>div.member_pic>a>img')
names=soup.select('#floatRightBox>div.js_box.clearfix>div.w240>h6>a')
sex.soup.select('#floatRightBox>div.js_box.clearfix>div.member_pic>div')
for tittle, address, price, img, name, sex in zip(tittle,addresses,prices,imgs,names,sexs):
data={
'tittle':tittle.get_text().strip,
'address':address.get_text().strip(),
'price':price.get_text(),
'img':img.get("src"),
'name':name.get_text(),
'sex':judgment_sex(sex.get("clas"))
}
print(data)

if name == '__main__':
urls=['http://bj.xiaozhu.com/search-duanzufang-p{}-0/'.format(number)for number in range (1,14)]
for single_url in urls:
get_links(single_url)
time.sleep(4)

1个回答

你的代码没有缩进,没法帮你调试

你可以用fiddler抓包看下,你得到的数据和浏览器访问得到的有什么不同

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
为啥没有结果输出
Private Sub Form_Load()rn For i = 1 To 100rn S = S + irn Nextrn Print SrnEnd Subrnrn为何窗体上看不到计算结果输出来
构造函数为啥没有运行?
[code=c]#include rnrnrnclass B;rnclass A;rnrnclass Arnrnpublic:rn A()rn rn std::cout << "A Create!" << std::endl;rn rn ~A()rn rn std::cout << "A Destory!" << std::endl;rn rnrn void print()rn rn std::cout << "Class A mSP Ref Count: " << mB.use_count() << std::endl;rn rnrnpublic:rn boost::shared_ptr mB;rn;rnrnclass Brnrnpublic:rn B()rn rn std::cout << "B Create!" << std::endl;rn rn ~B()rn rn std::cout << "B Destory!" << std::endl;rn rnrn void print()rn rn std::cout << "Class B mSP Ref Count: " << mA.use_count() << std::endl;rn rnrnpublic:rn boost::shared_ptr mA;rn;rnrnvoid func()rnrn boost::shared_ptr a(new A);rn boost::shared_ptr b(new B);rn std::cout << "a use_count: " << a.use_count() << std::endl;rn std::cout << "b use_count: " << b.use_count() << std::endl;rnrn a->mB = b; //到这里就崩溃rn b->mA = a;rn //a->print();rn //b->print();rnrn std::cout << "> a use_count: " << a.use_count() << std::endl;rn std::cout << "> b use_count: " << b.use_count() << std::endl;rnrnrnint main()rnrn func();rnrn getchar();rn return 0;rn[/code]rnrn这个程序一到a->mB = b;就会崩溃,单步跟就发现new A的时候A的构造函数并没有被调用,导致mB这个成员没有初始化,"A Create!"这句话没有打出来。请问这是为什么,我是参照循环引用的例子写的,请见rnhttp://www.cnblogs.com/TianFang/archive/2008/09/20/1294590.htmlrn但人家这个程序可以跑的
为啥能运行,结果不对
#includern#define N 3rn#define M 4rnfloat score[M][N];rnfloat class[M],people[N];rnint main()rnrn int i,j;rn float h;rn void input(void);rn void aver1(void);rn void aver2(void);rn input();rn aver1();rn aver2();rn printf("\nNO. cour1 cour2 cour3 cour4 aver\n");rn for(i=0;i
运行为什么没有结果????????????
for i:=2 to 100 dorn beginrn if data.cells[i,1].value=null thenrn beginrn data.cells[i,1].value:=edit6.Text;rn data.cells[i,2].value:=timetostr(time);rn break;rn end;rn end;rn //往excel表格中写内容,编译通过,为什么表格仍然为空?
为啥 debug和普通运行的结果不一致
debug下结果没问题运行程序就出不了结果为啥rn功能rn从键盘输入一个字符串,显示出现次数最少的最晚输入的一个字符及个数。rne.g.>djtyddy(输入)rn t:1(输出)rn代码rnMyStack segment stackrndw 128 dup(?)rnMyStack endsrnrnrndata segmentrnstring db 100,?,100 dup(?);接受输入rncount db ?;记录各个字符出现的次数rntemp db 99;记录当前出现次数最少的字符数rnresult db ?;记录出现次数最少且最后出现的字符rnrndata endsrnrncode segmentrnrnassume cs:code,ds:data,ss:MyStackrnrnrnstart:rn mov ax,datarn mov ds,axrn ;mov es,axrn rn ;接受输入rn Lea di,stringrn mov ah,10drn int 21hrn rn call crrn rn rn xor cx,cxrn mov CL,string+1rn Lea bx,stringrn add bx,2rn rnLab:rn mov dh,[bx]rn call comparern mov DL,countrn rn cmp temp,DLrn jc run; temp-count<0rn mov temp,DLrn mov result,dhrn rnrun: rn inc bxrn mov DL,0rn mov count,DLrn cmp CX,0rn jz Lab_overrn loop Labrn rn rnLab_over:rn; call crrn mov ah,2rn mov DL,resultrn int 21hrn rn mov dL,':'rn int 21hrn rn mov ah,2rn mov DL,temprn add DL,30hrn int 21h rn rn rn mov ah,4chrn int 21hrn rn;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rn;;;;;子程序;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rn;子程序1:实现回车换行rnCR proc nearrn push axrn push dxrn rn mov ah,2rn mov DL,0ahrn int 21hrn mov DL,0dhrn int 21hrn rn pop dxrn pop axrn rn retrnCR endp rn;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rn;;;;子程序2:实现字符的比较统计相同字符数量rncompare proc nearrn push bxrn push cxrn rn xor cx,cxrn mov CL,string+1rn Lea bx,stringrn add bx,2rn rnnext:rn cmp dh,[bx]rn jz samern jmp continuernrnsame:rn inc countrnrncontinue:rn inc bxrn cmp CX,0rn jz Lab_1rn loop nextrn rnLab_1:rn pop cxrn pop bxrn rn retrnrncompare endprn rnrn;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rn rn rn rncode endsrnend start
为什么运行没有结果?急
用forms bulider 作了一个程序,运行表单调试,可是在ie下没有任何反应,只是提示applet已经初始化,可是没有报错,我在when new form instance设了断点,可是根本就没运行到断点,大家帮帮忙!
VBA运行程序没有结果
在人家电脑上面运行有结果,为什么换到我电脑上面就会弹错:rn With ActiveSheet.PageSetuprn .PrintQuality = 600rn运行是错误'1004'rn不能设置类PageSetup的PrintQuality属性rn注释掉上面那句之后,编译能通过,但得不到程序实际要运行的结果,没有程序输出结果!!rn会不会要引用其他库文件!!
为什么sqlserver运行没有结果,delphi运行就有结果
SELECT MineID,StafferID,JHBanID,BanTypeID,PlanDate,PlanStartTime,PlanEndTime,rn PlanChangeReasonrnFROM(rnSELECT Mineid,StafferID,ISNULL(BGBanID,JHBanID) JHBanID,BanTypeID,rnISNULL(PlanDate1,PlanDate) PlanDate,rn ISNULL(PlanStartTime1,PlanStartTime) PlanStartTime ,rnISNULL(PlanEndTime1,PlanEndTime) PlanEndTime,PlanChangeReasonrnFROM DownPlan rn WHERE (CONVERT(VARCHAR(100),PlanDate,23)>=CONVERT(VARCHAR(100),@QSSJ,23) and CONVERT(VARCHAR(100),PlanDate,23)<=CONVERT(VARCHAR(100),@QSSJ,23) ) OR rn(CONVERT(VARCHAR(100),PlanDate1,23)>=CONVERT(VARCHA(100),@QSSJ,23) and rn CONVERT(VARCHAR(100),PlanDate1,23)<=CONVERT(VARCHAR(100),@QSSJ,23))rn) drnWHERE CONVERT(VARCHAR(100),d.PlanDate,23)>=CONVERT(VARCHAR(100),@QSSJ,23) and rnCONVERT(VARCHAR(100),d.PlanDate,23)<=CONVERT(VARCHAR(100),@QSSJ,23)rnrnrn@QSSJ varchar(19)rnrn@QSSJ 的格式 2011-07-18rn测试过2011-07-18 00:00:00也不行
Jupyter运行scala程序
应用背景 学习 scala, 为后续Spark开发打基础 博文通过 Demo 给出如何在 Jupyter 中定义并调用 Scala程序。 Jupyter Notebook 进行Python 开发 逐渐被更多的人所接受、熟知,从而应用于大数据预处理、分析,通过Jupyter 运行Scala 程序讲解文章相对较少。 基础知识 新手,有经验直接略过 Scala 菜鸟教程 Scala...
jupyter安装配置(Virtualbox运行)
python3 -m pip install --upgrade pip python3 -m pip install jupyter 运行: jupyter notebook 如果jupyter是运行在virtualbox虚拟机里面,那么可以设置virtualbox允许主机访问: 由于virtualbox设置成了NAT网络连接,因此需要通过端口转发的方式,允许宿主机器访问。 jupyter...
Jupyter 运行Anaconda的虚拟环境
1 环境ubuntu-16.04.4-desktop-amd64jupyter 5.5.02 安装命令2.1 安装ipykernelconda install ipykernel 2.2 激活虚拟环境source activate 环境名称 2.3 写入Jupyter的kernel中python -m ipykernel install --user --name 环境名称 --display...
jupyter notebook运行出错
win7,python2.7.13rn第一次安装使用jupyter notebook,用pip安装的rnrnjupyter notebook运行出错rn报错信息rn[code=html][C 01:27:32.831 NotebookApp] Bad config encountered during initialization:rn[C 01:27:32.832 NotebookApp] Could not decode 'C:\\Users\\\xce\xf7\xb9\xcf\\.jupyter' for unicode trait 'config_dir' of a NotebookApp instance.[/code]rn[img=https://img-bbs.csdn.net/upload/201701/07/1483724340_941996.png][/img]rn这是怎么回事呢?rnrn我作出的尝试:rn在网上找了几篇答案rnhttp://stackoverflow.com/questions/33661870/ipython-notebook-cannot-start-up-windows-8-1rn按照第3个人的方法rnhomedir = os.path.expanduser('~')rn改成rnhomedir = os.path.abspath('yourpath')rn再运行,报错信息是rnWindowsError: [Error 123] : 'C:\\Python27\\Lib\\site-packages\notebook'rn[img=https://img-bbs.csdn.net/upload/201701/07/1483724283_240866.png][/img]rn
Jupyter安装及运行
一、安装(来自http://jupyter.org/install)Ctrl+Alt+T(Linux系统),打开控制台,su进入root权限输入如下命令:python3 -m pip install --upgrade pip python3 -m pip install jupyter二、启动Jupyter控制台下jupyter notebok,使用的时候报错好像是没有权限的意思,执行了chmo...
jupyter上运行python代码
修改pip源为国内源 修改为国内源的好处是下载速度快 https://www.cnblogs.com/believepd/p/10499844.html 安装和启动jupyter notebook https://blog.csdn.net/scut_salmon/article/details/79278907 上传文件和文件夹 文件: upload – 选择相关文件 文件夹:jupy...
远程服务器的jupyter的运行
重点:在用anaconda自己创建的环境中,运行jupyter 这篇记录的根源是:我在一个远程服务器安装tensorflow(利用anaconda安装),但是我的账户没有root权限,只能在我的用户文件夹下安装anaconda, 然后创建tensorflowflow的环境,正常情形下,如果不在特定的环境下重新安装jupyter notebook的话,命令会使用系统默认的jupyter,但是系统
为啥是这个结果
[code=Java]rn int x=1;rn int y = 2;rn int z = 3;rn y+=z--/++x;rn System.out.print("x="+x+"y="+y+"z="+z);rnrn答案为啥:x=2y=3z=2 y为什么不是3.5rnrn[/code]
为啥是这个结果?
#include "stdio.h"rnmain()rnrn int a,b;rn a=3;rn b=a++;rn printf("%d,%d\n",a,b);rnrnrnb为啥是3?
这个结果为啥不对
[img=https://img-bbs.csdn.net/upload/201607/30/1469828991_647965.png][/img]rnrnrnrn-rn这个地址用od和CE看 都是1.4但是弹出来的确实不是 1.4 。这是为啥啊。。。我怎么才能把上面那个整数型变量 转换成 1.4。rnrnrnrnrn-rn谢谢大家
结果为啥不对
[code=sql]rnUSE [lgz]rnGOrnSET IDENTITY_INSERT [dbo].[基本分类] ON rnrnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (1, N'笔记本电源', 0, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (2, N'供应商', 0, N'来往单位分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (3, N'客户', 0, N'来往单位分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (4, N'现金', 0, N'资金分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (5, N'银行资金', 0, N'资金分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (6, N'正常仓库', 0, N'仓库分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (7, N'惠普电源', 1, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (8, N'联想电源', 1, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (9, N'宏基电源', 1, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (10, N'音响', 0, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (11, N'大音响', 10, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (12, N'小音响', 10, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (13, N'M10', 11, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (14, N'M30', 12, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (15, N'111', 9, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (16, N'222', 8, N'商品分类')rnGOrnINSERT [dbo].[基本分类] ([ID], [名字], [父级ID], [标识]) VALUES (17, N'55', 16, N'商品分类')rnGOrnSET IDENTITY_INSERT [dbo].[基本分类] OFFrnGOrn[/code]rnrn上面试表数据,结构rnrn想要的结果rnrn[code=sql]rn1 笔记本电源 0 商品分类rn7 惠普电源 1 商品分类rn8 联想电源 1 商品分类rn16 222 8 商品分类rn17 55 16 商品分类rn9 宏基电源 1 商品分类rn15 111 9 商品分类rn2 供应商 0 来往单位分类rn3 客户 0 来往单位分类rn4 现金 0 资金分类rn5 银行资金 0 资金分类rn6 正常仓库 0 仓库分类rn10 音响 0 商品分类rn11 大音响 10 商品分类rn13 M10 11 商品分类rn12 小音响 10 商品分类rn14 M30 12 商品分类rn[/code]rnrn自己修改的代码,rn[code=sql]rn WITH Tmep_基本分类 ASrn (rn SELECT ID,名字,标识,父级ID,ID 'ZID',1 'lv' FROM [基本分类] WHERE 父级ID=0rn UNION ALLrn SELECT b.ID,b.名字,b.标识,b.父级ID,a.ZID,a.lv+1 'lv' FROM Tmep_基本分类 a INNER JOIN [基本分类] b ON a.ID=b.父级IDrn )rn SELECT rn IDrn ,IIF(父级ID = 0,名字,CAST(REPLICATE(' ',lv)+名字 AS VARCHAR(50))) '名字'rn ,父级ID rn ,标识rn FROM Tmep_基本分类 ORDER BY ZID,IDrn[/code]rnrn但是结果不对,不知道哪里出问题了 !rn[code=sql]rn1 笔记本电源 0 商品分类rn7 惠普电源 1 商品分类rn8 联想电源 1 商品分类rn9 宏基电源 1 商品分类rn15 111 9 商品分类rn16 222 8 商品分类rn17 55 16 商品分类rn2 供应商 0 来往单位分类rn3 客户 0 来往单位分类rn4 现金 0 资金分类rn5 银行资金 0 资金分类rn6 正常仓库 0 仓库分类rn10 音响 0 商品分类rn11 大音响 10 商品分类rn12 小音响 10 商品分类rn13 M10 11 商品分类rn14 M30 12 商品分类rn[/code]rn
为啥结果总是不正确?
/*把学生的数据输入,并求平均成绩*/rn#include rn#define SIZE 5rnstruct studentrnint num;rn char name[10];rn float score[4];rnstu[SIZE];rnrnvoid save()rnFILE *fp;rn int i;rn if((fp=fopen("stud","wb"))==NULL)rn printf("cannot open file\n");rn exit(0);rn rn for(i=0;irn#define SIZE 5rnstruct studentrnint num;rn char name[10];rn float score[4];rnstu[SIZE];rnrnmain()rnint i;rn FILE *fp;rn fp=fopen("stud","rb");rn for(i=0;i
结果为啥是5?
[code=c][/code]rn#include rnint main(void)rnrn int a[] = 1,2,3,4,5;rn int *ptr = (int *)(&a +1);rn printf("%d %d",*(a+1),*(ptr-1));rn return 0;rnrnrn[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/8.gif][/img]
结果为啥是:8
//结果为啥是: 8rnrn[code=C/C++]#include rnusing namespace std;rnrnint func(int x)rnrn int countx = 0;rn while (x)rn rn countx++;rn x=x&(x-1);rn rn return countx;rnrnrnint main()rnrn cout<
为啥结果不一样?
void IntToString(int nNum[], int nLen, char* cNum, char* sz_num[]);rnvoid FindRepeatNumer(int nNum[], int nLen, char* sz_num[]);rnint isSubString(char* pSub, char* sz_num[], int nLen);rnint main(void)rnrn char cNum[1000] = 0;rn int arr_num[3] = 4, 11, 11;rn char* sz_num[100] = NULL;rn rn IntToString(arr_num, 3, cNum, sz_num);rn FindRepeatNumer(arr_num, 3, sz_num);rnrnvoid FindRepeatNumer(int nNum[], int nLen, char* sz_num[])rnrn char szNum[100] = 0;rn int i = 0;rn for(;i < nLen;++i)rn rn IntToString(&nNum[i], 1, szNum, sz_num);rn if(isSubString(szNum, sz_num, nLen))rn rn printf("repeatNumber:%d\n", nNum[i]);rn rn rnrnrn/*rn是否有子串rn*/rnint isSubString(char* pSub, char* sz_num[], int nLen)rnrn rn int nCount = 0;rn for(int i = 0;i < nLen;++i)rn rn if(!strcmp(sz_num[i], pSub))rn rn ++nCount;rn rn rn if(nCount > 1)rn rn return 1;rn rn return 0;rnrnrnrnvoid IntToString(int nNum[], int nLen, char* cNum, char* sz_num[])rnrn if(NULL == nNum) throw "无效数据!";rn int index = 0;rn char szStr[1000] = 0;rn int i = 0;rn rn for(;i < nLen;++i)rn rn dorn rn szStr[index] = nNum[i] % 10 +'0';rn ++index;rn while((nNum[i] /= 10) > 0);rn index = 0;rn if(nLen > 1)rn rn char cTemp[4] = 0;rn int n = 0;rn for(int j = strlen(szStr)-1;j >=0 ;--j)rn rn cTemp[n] = szStr[j];rn ++n;rn rn sz_num[i] = cTemp;rn rn rn rn rn for(int j = 0;j < 3;++j)rn rn printf("%s\n", sz_num[j]);rn rn i = 0;rn int nCnt = 0;rn for(i = index - 1;i >= 0;--i)rn rn *(cNum+nCnt) = szStr[i];rn ++nCnt;rn rn rnrn
Jupyter运行之后没结果,左边只出现In[*]
出现这种就是在某一段代码中卡死了,可能是bug,也可能是跑数据的过程太过复杂导致程序仍在运行中 如果不知道是哪一段的话,就在页面上方的kernel出点击里面的 Restart &amp;amp; Run All,接下来还会停留在出问题的位置,就可以针对这个做出相应对策 ...
为啥没有MTK的版块。。。
如题
为啥没有打印?
[code=C/C++]rn#include rnrn#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))rnrnint array[] = 23,34,12,17,204,99,16;rnrnint main()rnrn int d;rn for(d = -1; d <= TOTAL_ELEMENTS - 2; d++)rn printf("%d\n", array[d + 1]);rnrn return 0;rnrn[/code]rn为啥没有打印数组的值?
为啥没有tcp的命名空间?
当我写tcp服务端的程序时,我发现我的.net里没有System.Runtime.Remoting.Channels.Tcp的命名空间,但是帮助文档中有。rn请告知。谢谢。
为啥jar包没法运行。
我已经安装了jsdk1.4和java运行环境1.3,也已经将.jar文件映射到了java运行环境目录下javaw.exe上rn现有一个jar包,ibm官方网站上下的,不会有问题,但双击运行后提示:can't find the main class,programe not exit!rn请教为什么?rn谢谢
服务程序为啥不能运行?
void __fastcall TService1::ServiceExecute(TService *Sender)rnrn while ( !Terminated )rn rn // 我的代码rn //------------------------rn Sleep(500); rn ServiceThread->ProcessRequests(false);rn rnrn怎样才能进入到这个函数运行呢?第一次做服务程序,已经做了另一个安装服务的程序,
为啥运行不了?
程序如下:rnmain()rnrn int a;rn int b;rn int *p1;rn int *p2;rn a=100;rn b=10;rn p1=&a;rn p2=&b;rn printf("%d,%d\n",a,b);rn printf("%d,%d\n",*p1,*p2);rn
为啥运行不通?
#include rn#include rn#include rn#include rn#include rn#include rnrnHANDLE hSemaphore;rnUINT ThreadProc15(LPVOID Pparam)rnrn WaitForSingleObject(hSemaphore,INFINITE);rn AfxMessageBox("线程一再执行");rn ReleaseSemaphore(hSemaphore,1,NULL);rn return 0;rnrnUINT ThreadProc16(LPVOID Pparam)rnrn WaitForSingleObject(hSemaphore,INFINITE);rn AfxMessageBox("线程二再执行");rn ReleaseSemaphore(hSemaphore,1,NULL);rn return 0;rnrnUINT ThreadProc17(LPVOID Pparam)rnrn WaitForSingleObject(hSemaphore,INFINITE);rn AfxMessageBox("线程三再执行");rn ReleaseSemaphore(hSemaphore,1,NULL);rn return 0;rnrnrnvoid CSample06View::OnSemaphore()rnrn hSemaphore=CreatSemaphore(NULL,2,2,NULL);;rn AfxBeginThread(ThreadProc15,NULL);rn AfxBeginThread(ThreadProc16,NULL);rn AfxBeginThread(ThreadProc17,NULL);rnrn
为啥不能运行里
package ch01;rnrnimport java.awt.Component;rnimport java.awt.event.ActionEvent;rnimport java.awt.event.ActionListener;rnimport java.awt.event.KeyAdapter;rnimport java.awt.event.KeyEvent;rnrnimport javax.swing.JButton;rnimport javax.swing.JFrame;rnimport javax.swing.JLabel;rnimport javax.swing.JPanel;rnimport javax.swing.JPasswordField;rnimport javax.swing.JTextField;rnimport javax.swing.WindowConstants;rnrnpublic class Login extends JFramern private JLabel userLabel;rn private JLabel passLabel;rn private JButton exit;rn private JButton login;rn private Main window;rn private Component userPasswordField;rn private static TbUserlist user;rn public Login()rn setTitle("超市管理系统");rn final JPanel panel = new LoginPanel();rn panel.setLayout(null);rn getContentPane().add(panel);rn setBounds(300,200,panel.getWidth(),panel.getHeight());rn userLabel = new JLabel();rn userLabel.setText("用户名:");rn userLabel.setBounds(140,160,200,18);rn panel.add(userLabel);rn final JTextField userName = new JTextField();rn userName.setBounds(190,160,200,18);rn panel.add(userName);rn passLabel = new JLabel();rn passLabel.setText("密码:");rn passLabel.setBounds(140,200,200,18);rn panel.add(passLabel);rn final JPasswordField userPassword = new JPasswordField();rn userPasswordField.addKeyListener(new KeyAdapter()rn public void keyPressed(final KeyEvent e)rn if(e.getKeyCode()==10)rn login.doClick();rn rn );rn userPassword.setBounds(190,200,200,18);rn panel.add(userPassword);rn login = new JButton();rn login.addActionListener(new ActionListener()rn @SuppressWarnings("deprecation")rn public void actionPerformed(final ActionEvent e)rn user = Dao.getUser1(userName.getText(),userPassword.getText());rn if(user.getUsername1()==null||user.getUsername()==null)rn userName.setText(null);rn userPassword.setText(null);rn return;rn rn setVisible(false);rn window = new Main();rn ((Component) window.frame).setVisible(true);rn rn );rn login.setText("登录:");rn login.setBounds(200,250,60,18);rn panel.add(login);rn exit = new JButton();rn exit.addActionListener(new ActionListener()rn public void actionPerformed(final ActionEvent e)rn System.exit(0);rn rn );rn exit.setText("退出:");rn exit.setBounds(280,250,60,18);rn panel.add(exit);rn setVisible(true);rn setResizable(false);rn setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);rn rn public static TbUserlist getUser()rn return user;rn rn public static void setUser(TbUserlist user)rn Login.user = user;rn rn rn rn private static final long serialVersionUID = 1L;rnrn public static void main(String[] args)rn new Login();rnrn rnrnrn
HelloWorld为啥不能运行?
我把jdk1.3装到d盘,环境变量设置如下rnclasspath:d:\jdk1.3\lib\dt.jar;d:\jdk1.3\lib\tools.jarrnPath: d:\jdk1.3\binrn用notepad编写HelloWorld.java代码如下rnpublic class HelloWorldrnrnpublic static void main(String[] argv)rnrn/*javadoc will ignore this commment*/rnSystem.out.println("HelloWorld");rn rnrn保存在d:\jdk1.3\bin目录下rn但是运行时出现错误:rnd:\jdk1.3\bin\javac HelloWorld.javarn错误 不能读HelloWorld.javarn1个错误rn请问大虾这是怎么回事?而且用命令cmd时,显示的是c:\>rn是不是我的环境变量设置错误?多谢指点!rn
为啥运行不了
编写的时候交互界面可以运行,存为文件运行不了[img=https://img-bbs.csdn.net/upload/201809/10/1536584414_662774.png][/img][img=https://img-bbs.csdn.net/upload/201809/10/1536584415_131512.png][/img]
为什么运行没有结果?(在线等)
#include rnint main()rnrn int m=1,count=0;rn double n=1.01,num=0;rn while(num
我这个SQL语句,运行没有结果的?
create table T (v int)rninsert into T rnselect 1rnunion all select 2rnunion all select 3rnunion all select 4rnrnselect * from Trnrndeclare @a intrndeclare @b intrnselect @a=10rnselect @b=0rnselect @a=@a+v,@b=@b+v from Trnrn看看该怎么改,谢谢
编译不报错 但是运行没有结果
[code=c]rn#include rn#include rnrnrntypedef struct LNodern int color;rn int data;rn struct LNode *next;rnLNode, *LinkList;rnrnrnvoid InitList(LinkList &L)rn L = (LinkList)malloc(sizeof(LNode));rn L->color = 0;rn L->data = 0;rn L->next = NULL;rnrnrnvoid CreateList(LinkList &L)rn LinkList p, q;rn q = L;rn int i = -1, j = 1;rn while (1)rn int flag = 1; rn p = (LinkList)malloc(sizeof(LNode));rn q->next = p;rn p->next = NULL;rn p->color = j;rn p->data = i;rn q = p;rn rn if (i < 13)rn i++;rn rn rn else if (i == 13 && j != 4)rn i = 1;rn j++;rn rn rn else if (i == 13 && j == 4 && flag)rn i = -1;rn j = 1;rn// count++;rn flag = 0;rn rn rn if (i == 13 && j == 4 && !flag)rn break;rn rn rn rnrnrnrnvoid filltrate(LinkList &L)rn LinkList p, q, r;rn q = L;rn p = L->next;rn int count = 1;rn rn r = L;rn while (r->next)rn r = r->next;rn rn rn while (p->next)rn if (count&2 != 0)rn q->next = p->next;rn free(p);rn p = q->next;rn p->next = q->next->next;rn count++;rn rn rn else if (count&2 == 0)rn q->next = p->next;rn r->next = p;rn r = p;rn p->next = NULL;rn p = q->next;rn count++;rn rn rn rn switch (p->color)rn case 1:rn printf("黑桃"); rn break;rn rn case 2:rn printf("红桃");rn break;rn rn case 3:rn printf("方块");rn break;rn rn case 4:rn printf("梅花");rn break;rn rn rn rn switch (p->data)rn case -1:rn printf("大王\n");rn break;rn rn case 0:rn printf("小王\n");rn break;rn rn default:rn printf("%d\n", p->data);rn break;rn rn rn rnrnrnrnint main()rnrn LinkList L;rn rn InitList(L);rn CreateList(L);rn filltrate(L);rn rn return 0;rn rn[/code]rnrn[b]初学,请大神帮忙看看是什么问题![/b]
sql语句没有结果 可以直接运行
insert getmessage (name,tel, email,produce ,selected,message)values ('111','2221111','333','NA-1光纤数值孔径测试仪 CT-07精密光纤切割刀 CTS650系列 对称数字通信电缆测试系统 CTS650A1 CSF电缆理想屏蔽系数测试仪 ','4,8,13,17,','需要报价')rnsql 语句没问题rnrnSqlConnection myconnection = new SqlConnection("user id=sa;password=xxx;initial catalog =secri;data source=192.168.0.1;Connect Timeout=30");rn rn myconnection.Open();rn SqlDataAdapter MyCommand = new SqlDataAdapter(sqlstr , myconnection); rn rn myconnection.Close();rn Message.Text += "insert finish";rn如何知道到底那里又问题了呢?
编译没有报错,运行不能输出结果
#include rnusing namespace std;rnint main()rnrn cout<<"welcome to eclipse!---"<
运行JavaScript没有结果,哪里出了问题?
最近几天才入门,没有找到好的视频。rn用的是sublime Text2中文版。rn代码如下rnrn rnrn然后保存类型为“所有类型”。文件名称为a.htmlrn可是双击这个文件后,浏览器没有显示hi!rnrn可是我用notepad++写的就显示了hi!rnrn我还想问,我可以以后就用notepad++吗?需要下载其他什么插件还是就直接用?rn大家还有什么建议?
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制