本文介绍了pycharm中指出的错误帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。 Def displayMenu():pycharm说该函数应该是小写的。它对其他功能也是如此。

2.未解决 引用 'if__name __'  less ... (Ctrl + F1)

此检查检测到应该解决但不能解决的名称。由于动态调度和鸭子打字,这在有限但有用的情况下是可能的。顶级和类级别项目比实例项目支持更好。



此检查检测语句没有任何影响。



3.选择= int(输入输入选项(1 ... 4):)

语法错误:语法无效^



请帮我解决这个问题



我的尝试:



def displayMenu():

print()

print(1.读取客户档案)

print(2添加客户)

打印(3.搜索客户)

打印(4.结束)

打印( )



def readFile():

打印(读取文件代码)



if__name __ ==__ main__



选择= 0

而选择!= 4:

displayMenu()



Choice = int(输入输入选项(1 ... 4):)

NoOfAttempts = 1

while(选择< 1或Choice> 4)和NoOfAttempts< ; 3:

如果选择== 1:

readFile()

elif选择== 2:

打印(添加客户代码)

elif选择== 3:

打印(打印客户代码)

解决方案

1. Def displayMenu(): pycharm say that function should be in lowercase. Its says the same for the other function.
2. Unresolved reference 'if__name__' less... (Ctrl+F1)
This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

This inspection detects statements without any effect.

3. Choice=int(input"Enter choice (1...4)":)
SyntaxError: invalid syntax ^

Please help me solve this problem

What I have tried:

def displayMenu():
print()
print("1. Read customer file")
print("2. Add customer")
print("3. Search for a customer")
print("4. End")
print()

def readFile():
print("Read file code")

if__name__=="__main__"

Choice= 0
while Choice !=4:
displayMenu()

Choice=int(input"Enter choice (1...4)":)
NoOfAttempts=1
while(Choice<1 or Choice>4) and NoOfAttempts<3:
if Choice==1:
readFile()
elif Choice==2:
print("Add customer code")
elif Choice==3:
print("Print customer code")

解决方案


这篇关于pycharm中指出的错误帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 09:02