商城项目.zip
为什么“家电”跑到上面去了,咋办
老师好,今天在看这个视频后,想要自己去分析一下Object类,任何一个类的超类。发现 他没有构造函数。这Object源码中没有写构造函数,是编译器自动加了构造函数,是吗?可以讲解一下这里吗?
老师为什么,运行debug是这样的。好像是跳到源码了
from django.http import JsonResponse from rest_framework.parsers import JSONParser from rest_app.models import Student from rest_app.serializers import StudentSerializer from django.views.decorators.csrf import csrf_exempt #不进行csrf检测 @csrf_exempt def students(request): #GET请求(获取) if request.method == 'GET': #获取所有的student数据 student_li = Student.objects.all() #进行序列化,many=True serializer = StudentSerializer(student_li,many=True) #返回一个json格式的响应到客户端 #safe为True,必须传入字典。但是前面传入的是列表,只要是字典以外的格式都要将safe设为false #没有指定响应状态吗,默认是200 return JsonResponse(serializer.data,safe=False) #POST请求(新增) elif request.method == 'POST': #使用JSONParser将request的主题内容进行反序列化 data = JSONParser().parse(request) #将上一部的字典数据传入到序列化中 serializer = StudentSerializer(data=data) #进行验证 if serializer.is_valid(): #保存数据到数据库 serializer.save() #返回201状态码 和 辛堡村的数据库的数据 201:新增 return JsonResponse(serializer.data,status=201) #数据验证失败,则返回400状态码 和 序列化类的所有错误信息 return JsonResponse(serializer.errors,status=400)
老师 我的代码何老师的一样,为什么 不管是 在Terminal中还是 在程序跑起来,都会报一个错误,报错代码如下
我尝试调整版本问题 依据是如下图
不管怎么样调整还是不对 ,麻烦老师帮忙解答下。已经换了两台电脑进行检测了
老师你好,是不是用锁的时候只要是 RLock() 就不会出现死锁?
老师这是什么问题呢、
num = 0 for num in range(1,101) : num +=1 ##### num = 0 for num < 100 : num +=1
老师,为什么while num < 100 :可以,而 for num < 100 就报错呢?
package com.itbaizhan; public class MySinglyLinkedList<E> implements MyList { //定义单向链表中的节点对象 class Node<E>{ private E item;//存储元素 private Node next;//存储下一个节点对象地址 Node(E item,Node next){ this.item = item; this.next = next; } } private Node head;//存放列表中的头节点 private int size;// 记录个数 //添加元素 @Override public void add(E element) { //报错!!!!!!!!!划红线了 //创建节点 Node<E> node = new Node<>(element,null); //找到到尾节点 //节点的挂接 //记录元素个数 } //获取元素 @Override public Object get(int index) { return null; } //获取元素个数 @Override public int size() { return 0; } //删除元素 @Override public Object remove(int index) { return null; } }
老师,这个地方为什么会报错,我的ServerThread类也是存在的呀,报错的意思是我没有这个类
server and client.zip
wsk.rar
老师:我的IDEA这个页面上没有 Allow parellel run,不知道在哪儿啊?
还有这个,家里 encoding = utf-8 还是不行
解释器选中了,但是点完垃圾桶,重新打开终端没有进入game_env,请问这个怎么解决?
def dictionary_reader(filename): """ :param filename: The type of the filename is string, which means users need to input a string type's filename. :return: a list which contain each word in the file """ words_no_punctuation = [] words_less_than_9 = [] try: # open the file and execute the read operation f = open(filename, 'r') # append the each word speratly into a list words = f.readlines() for word in words: words_no_punctuation.append(word.strip()) for word in words_no_punctuation: if len(word) <= 9: words_less_than_9.append(word) # print(len(words_less_than_9)) # This is the test part of the dictionary_reader # Test passd, if length of list equal to 235887 x = '' for word in words_less_than_9: if len(word) > 9: x = False break else: x = True continue if x == False: print("Not all of the len of word in this list, which is less than 9 characters.") else: print("-----Test passed! All words in this list are less than 9 characters-----") if len(words) == 235887: print("-----Test passed! There are 235887 words in the list!-----") else: print("The len of words is not equal to the len of word in the words.txt.") if isinstance(words_less_than_9, list): print("-----Test pssed! The function dictionary_reader will return the all words which len are less than 9 characters in a list!-----") else: print("The return stuff is not the list type.") return words_less_than_9 except BaseException as e: # print the error information when programme meet error # it is easy to help users matain the programme print(e) finally: # make sure the file stream will be closed in any suitation of programme f.close() def word_lookup(): # read file at first # words is a list, and each elements in the words list is a word. words = dictionary_reader('words.txt') sorted_dictionary = [] longest_words = [] possibility_words = [] for word in words: """ every single word in the words list will be sorted by alphabetical. """ word = word.strip() # ensure every single word in the list is lowercase sorted_dictionary.append("".join(sorted(word)).lower()) print(sorted_dictionary)
words.txt WechatIMG945.png
老师您好,这是我写的的两个函数。在word_lookup里面我尝试把文件里面的每一个单子都变成字母排序,但是控制台输出的第一个单词并不是按字母排序去排序的,请问一下这是为什么?
输出在附件里面传上去了,不知道为什么不能够上传图片,抱歉。
谢谢老师
### 测试用户登录功能
POST http://127.0.0.1:5000/user/login/ Content-Type: application/json { "name":"baizhan", "pwd":"123" }
点完send之后报错
这个怎么解决 字数。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637